2_Image_Building

Table of Contents


This page extends the information from the "Building container images" page.


How to build images for ReSeeD

Connect to the builder VM:

export BUILD_USER="builder"
export BUILD_HOST="builder.example.net"

ssh "${BUILD_USER}@${BUILD_HOST}"

If the VM is running low on free storage space, remove the latest images (specifically the images themselves, not just the image tags):

df -h  # Check disk usage
docker image ls
# Multiple image ids (or "imagename:imagetag" strings) can be supplied at the same time
docker image rm exampleimageid1 exampleimageid2 exampleimageid3 []
# e. g. with IMAGE_IDs:
docker image rm ba53dde63be9 9a9381a088dd b5040966bef3 cc2f61dbdae0 []
# prune docker build cache
docker builder prune
docker buildx prune

Create a backup of the old/existing reseed directory (to allow going back to the old state if necessary):

cp -a reseed reseed_InsertTagOfTheOldImageHere
# ⚠️ The directory inside which the new images are build MUST be named "reseed",
# ⚠️ otherwise the names of the container images created won't match!
cd reseed
git pull

# !Optional! - Apply custom changes - Usually not mandatory
git apply example/path/to/example_changes.patch

Update hyrax/deploy_info.json and generate docker image tag string

./hyrax/deploy_info.sh
export DOCKER_IMAGE_TAG="$(git describe --always --long --tags)_$(jq -r '.last_deployed' < hyrax/deploy_info.json | sed 's|\+00:00$|UTC|g;s|:|-|g')"

# Check the docker image tag
echo "${DOCKER_IMAGE_TAG}"

Build the container images

# --no-cache prevents docker from using cached files and
# forces it to freshly pull the latest dependencies
docker compose -f docker-compose.yml build --pull --no-cache

Tag the fresh container images as latest before exporting them

docker image tag "reseed-app:latest" "reseed-app:${DOCKER_IMAGE_TAG}"
docker image tag "reseed-web:latest" "reseed-web:${DOCKER_IMAGE_TAG}"
docker image tag "reseed-workers:latest" "reseed-workers:${DOCKER_IMAGE_TAG}"

ℹ Tagging the images as latest on the builder VM makes life easier when exporting/copying them over to the actual ReSeeD VM on which they will run, because this eliminates the need for one error-prone "copy $DOCKER_IMAGE_TAG string to another machine" operation.

Transfer the container images to the desired ReSeeD / docker host as described on the "Transferring Images" page.