This commit is contained in:
Andrew Ferrazzutti 2025-03-13 23:51:47 +01:00 committed by GitHub
commit da90c48229
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 11 deletions

1
changelog.d/18210.misc Normal file
View file

@ -0,0 +1 @@
In scripts-dev/complement.sh, ensure that the synapse-workers & complement-synapse images are built from the local base synapse image that was just built, instead of from the latest synapse image pulled from a public registry.

View file

@ -31,14 +31,18 @@ release of Synapse, instead of your current checkout, you can skip this step. Fr
root of the repository:
```sh
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
docker build -t matrixdotorg/synapse:testing -f docker/Dockerfile .
```
Next, build the workerised Synapse docker image, which is a layer over the base
image.
image. To test with your local checkout, pass the name of the Synapse docker image
built in the previous step as a build argument. Otherwise, the build will pull the
image of the latest Synapse release and use that as the base of the workers image.
To test with a specific release of Synapse, set the `SYNAPSE_VERSION` build argument
to the desired release version.
```sh
docker build -t matrixdotorg/synapse-workers -f docker/Dockerfile-workers .
docker build -t matrixdotorg/synapse-workers --build-arg FROM=matrixdotorg/synapse:testing -f docker/Dockerfile-workers .
```
Finally, build the multi-purpose image for Complement, which is a layer over the workers image.
@ -47,7 +51,7 @@ Finally, build the multi-purpose image for Complement, which is a layer over the
docker build -t complement-synapse -f docker/complement/Dockerfile docker/complement
```
This will build an image with the tag `complement-synapse`, which can be handed to
This will build an image with the name `complement-synapse:latest`, which can be handed to
Complement for testing via the `COMPLEMENT_BASE_IMAGE` environment variable. Refer to
[Complement's documentation](https://github.com/matrix-org/complement/#running) for
how to run the tests, as well as the various available command line flags.

View file

@ -181,24 +181,38 @@ if [ -z "$skip_docker_build" ]; then
# Build the base Synapse image from the local checkout
echo_if_github "::group::Build Docker image: matrixdotorg/synapse"
$CONTAINER_RUNTIME build -t matrixdotorg/synapse \
--build-arg TEST_ONLY_SKIP_DEP_HASH_VERIFICATION \
--build-arg TEST_ONLY_IGNORE_POETRY_LOCKFILE \
-f "docker/Dockerfile" .
# Tag local builds with a dummy registry so that later builds
# may reference them instead of pulling from a remote registry
LOCAL_REGISTRY=localhost:5000
SYNAPSE_TAG=matrixdotorg/synapse
$CONTAINER_RUNTIME build \
-t "$SYNAPSE_TAG" \
-t "$LOCAL_REGISTRY/$SYNAPSE_TAG" \
--build-arg TEST_ONLY_SKIP_DEP_HASH_VERIFICATION \
--build-arg TEST_ONLY_IGNORE_POETRY_LOCKFILE \
-f "docker/Dockerfile" .
echo_if_github "::endgroup::"
# Build the workers docker image (from the base Synapse image we just built).
SYNAPSE_WORKERS_TAG=matrixdotorg/synapse-workers
echo_if_github "::group::Build Docker image: matrixdotorg/synapse-workers"
$CONTAINER_RUNTIME build -t matrixdotorg/synapse-workers -f "docker/Dockerfile-workers" .
$CONTAINER_RUNTIME build \
-t "$SYNAPSE_WORKERS_TAG" \
--build-arg FROM="$LOCAL_REGISTRY/$SYNAPSE_TAG" \
-f "docker/Dockerfile-workers" .
echo_if_github "::endgroup::"
# Build the unified Complement image (from the worker Synapse image we just built).
COMPLEMENT_SYNAPSE_TAG=complement-synapse
echo_if_github "::group::Build Docker image: complement/Dockerfile"
$CONTAINER_RUNTIME build -t complement-synapse \
$CONTAINER_RUNTIME build \
-t "$COMPLEMENT_SYNAPSE_TAG" \
`# This is the tag we end up pushing to the registry (see` \
`# .github/workflows/push_complement_image.yml) so let's just label it now` \
`# so people can reference it by the same name locally.` \
-t ghcr.io/element-hq/synapse/complement-synapse \
-t "ghcr.io/element-hq/synapse/$COMPLEMENT_SYNAPSE_TAG" \
-f "docker/complement/Dockerfile" "docker/complement"
echo_if_github "::endgroup::"