Files
spark/docker/sparkd/dev
John Colvin 2bf4502d06 docker: Add set_user/start_docker scripts
Leave the image's default user as 'root' so we can modify the non-root user's
uid/gid. This is a common technique used in containers to gain file permissions
in mounted dirs.

The default user's uid/gid can't be changed because a bash process runs under
their ownership as long as the container is up. A user's uid/gid cannot be
changed while that user owns a process (at least not via 'usermod').
2023-04-04 23:52:10 -04:00
..

Sparkd Dev Container

How to create a Sparkd VS Code Devcontainer

  1. Make sure the "Dev Containers" extension is installed in VS Code

  2. Make sure your Docker image is up to date

    docker pull johncolvin/bluetradingsystems:sparkd-dev
    
  3. Copy devcontainer.json from this folder to $workspaceFolder/.devcontainer/.

    # This assumes the 'workspaceFolder' is the repo root.
    # If this is not the case, set "workspaceFolder" to the correct path
    
    # Determine repo root (only works if you are in a dir inside the repo!)
    repoRoot="$(git rev-parse --show-toplevel)"
    workspaceFolder="$repoRoot"
    devcontainerFolder="$repoRoot/devcontainer/"
    mkdir -p "$devcontainerFolder"
    cp "$repoRoot/devcontainer.json "$devcontainerFolder"
    
  4. In the VS Code Command Palette, run Dev Containers: Reopen in Container


How to update the Docker image

  1. Change the image by modifying the Dockerfile (don't tag arbitrary images on your machine and push them to our repo on Docker Hub)

  2. After modifying the Dockerfile, (re)build the image

    ./build.sh --image johncolvin/bluetradingsystems:sparkd-dev
    
    • NOTE: The convention in Docker repos is to format image tags <user>/<repo>:<image_name> (hence the 'johncolvin' in the tag)
    • TODO (maybe): Push images with a common username, like 'bts'. For now, we'll just use 'johncolvin' because I happened to push the first image, and did so with a conventional tag.
  3. Commit the changes to Dockerfile in git

  4. Push the new image to Docker Hub

    docker push johncolvin/bluetradingsystems:sparkd-dev
    

    Note: The image doesn't have to be on Docker Hub, we can simply build it from scratch on our local machines (with the Dockerfile). However, this takes time. It is significantly quicker to download a prebuilt image, so we store it on a remote repository to save time when setting up a new dev machine.