added all new content authored by Paul's avatar Paul
**Table of Contents**
---
This page extends the information from the ["Building container images" page](/system/deployment/Building-Container-Images).
---
#### How to build images for ReSeeD
Connect to the builder VM:
```shell
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):
```shell
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 […]
```
Create a backup of the old/existing reseed directory (to allow going back to the old state if necessary):
```shell
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
git apply example/path/to/example_changes.patch
```
Generate docker image tag string
```shell
export DOCKER_IMAGE_TAG="$(git describe --always --long --tags)_$(date --utc --iso-8601=seconds | sed 's|\+00:00$|UTC|g;s|:|-|g')"
# Check the docker image tag
echo "${DOCKER_IMAGE_TAG}"
```
Build the container images
```shell
# --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
```shell
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](/system/deployment/3_Transferring_Images).