Skip to content

Base development Docker image used by other development Docker images

License

Notifications You must be signed in to change notification settings

kbuley/basedevcontainer

Repository files navigation

Base Dev Container

Base Alpine development container for Visual Studio Code, used as base image by other images

Alpine Debian Ubuntu

dockeri.co

Last release Last Docker tag Last release size GitHub last release date Commits since release

Latest size

GitHub last commit GitHub commit activity GitHub closed PRs GitHub issues GitHub closed issues

Lines of code Code size GitHub repo size

MIT Visitors count

Features

  • kbuley/basedevcontainer:alpine (or :latest) based on Alpine 3.19 in 873MB
  • kbuley/basedevcontainer:debian based on Debian Bookworm Slim in 581MB
  • kbuley/basedevcontainer:ubuntu based on Ubuntu LTS in 537MB
  • All images are compatible with amd64, 386, arm64, armv7, armv6 and ppc64le CPU architectures
  • Contains the packages:
    • libstdc++: needed by the VS code server
    • zsh: main shell instead of /bin/sh
    • git: interact with Git repositories
    • openssh-client: use SSH keys
    • nano: edit files from the terminal
    • neovim: vim, but even better
  • Contains the binaries:
    • gh: interact with Github with the terminal
    • bit: a modern git client
  • Custom integrated terminal
  • Cross platform
    • Easily bind mount your SSH keys to use with git
  • Supports SSH keys with Linux, OSX

Requirements

Setup for a project

  1. Download this repository and put the .devcontainer directory in your project. Alternatively, use this shell script from your project path

    # we assume you are in /yourpath/myproject
    mkdir .devcontainer
    cd .devcontainer
    wget -q https://raw.githubusercontent.com/kbuley/basedevcontainer/master/.devcontainer/devcontainer.json
    wget -q https://raw.githubusercontent.com/kbuley/basedevcontainer/master/.devcontainer/docker-compose.yml
  2. If you have a .vscode/settings.json, eventually move the settings to .devcontainer/devcontainer.json in the "settings" section as .vscode/settings.json take precedence over the settings defined in .devcontainer/devcontainer.json.

  3. Open the command palette in Visual Studio Code (CTRL+SHIFT+P) and select Remote-Containers: Open Folder in Container... and choose your project directory

More

devcontainer.json

  • You can change the "postCreateCommand" to be relevant to your situation. In example it could be echo "downloading" && npm i to combine two commands
  • You can change the extensions installed in the Docker image within the "extensions" array
  • VScode settings can be changed or added in the "settings" object.

docker-compose.yml

  • You can publish a port to access it from your host

  • Add containers to be launched with your development container. In example, let's add a postgres database.

    1. Add this block to .devcontainer/docker-compose.yml

      database:
        image: postgres
        restart: always
        environment:
          POSTGRES_PASSWORD: password
    2. In .devcontainer/devcontainer.json change the line "runServices": ["vscode"], to "runServices": ["vscode", "database"],

    3. In the VS code command palette, rebuild the container

Development image

You can build and extend the Docker development image to suit your needs.

  • You can build the development image yourself:

    docker build -t kbuley/basedevcontainer -f alpine.Dockerfile  https://github.com/kbuley/basedevcontainer.git
  • You can extend the Docker image kbuley/basedevcontainer with your own instructions.

    1. Create a file .devcontainer/Dockerfile with FROM kbuley/basedevcontainer

    2. Append instructions to the Dockerfile created. For example:

      • Add more Go packages and add an alias

        FROM kbuley/basedevcontainer
        COPY . .
        RUN echo "alias ls='ls -al'" >> ~/.zshrc
      • Add some Alpine packages, you will need to switch to root:

        FROM kbuley/basedevcontainer
        USER root
        RUN apk add bind-tools
        USER vscode
    3. Modify .devcontainer/docker-compose.yml and add build: . in the vscode service.

    4. Open the VS code command palette and choose Remote-Containers: Rebuild container

About

Base development Docker image used by other development Docker images

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •