Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 41 additions & 11 deletions docker/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,48 @@
set -e # exit on nonzero
set -u # undefined variables
set -o pipefail # pipefail propagate error codes
set -x # debugging
# set -x # debugging

TAG=${1:-}
TAG="${1:-}"
[ -z "${TAG}" ] && echo "Tag not provided, defaulting tag to dev_build" && TAG="dev_build"

[ ! $TAG ] && echo "Tag not provided, defaulting tag to dev_build" && TAG=dev_build
declare -a DOCKER_ARGS

# When building locally, a developer can override the base image via
# SYN_BASE_IMAGE="my_awesome_synapse_image" ./docker/build_all.sh
[ -n "${SYN_BUILD_BASE_IMAGE:-}" ] && DOCKER_ARGS+=('--build-arg' "BASE=${SYN_BUILD_BASE_IMAGE}")

# By default the script will always pull the newest base image from the registry.
# This way, once a new base image is updated in the registry, the release
# process will ensure the new base is used. When building locally, a developer
# might want to try a custom base image without uploading it first, and this
# behaviour will lead to a failure. The developer can disable image pulling by
# SYN_BUILD_PULL=0 ./docker/build_all.sh
[ "${SYN_BUILD_PULL:-1}" != "0" ] && DOCKER_ARGS+=('--pull')

# By default the script will disable cache during builds for stable CI
# behaviour. When building locally, a developer might speed things up:
# SYN_BUILD_USE_CACHE=1 ./docker/build_all.sh
[ "${SYN_BUILD_USE_CACHE:-}" != "1" ] && DOCKER_ARGS+=('--no-cache')

# To build locally on post-M1 Mac's with new docker, the following might be required:
# SYN_BUILD_PLATFORM="linux/amd64" ./docker/build_all.sh
[ -n "${SYN_BUILD_PLATFORM:-}" ] && DOCKER_ARGS+=('--platform' "${SYN_BUILD_PLATFORM}")

# Build target images
docker builder prune -a -f
docker build --no-cache --progress plain --pull -t vertexproject/synapse:$TAG -f docker/images/synapse/Dockerfile .
docker/build_image.sh aha $TAG
docker/build_image.sh axon $TAG
docker/build_image.sh cortex $TAG
docker/build_image.sh cryotank $TAG
docker/build_image.sh jsonstor $TAG
docker/build_image.sh stemcell $TAG
[ "${SYN_BUILD_USE_CACHE:-}" != "1" ] && docker builder prune --all --force

docker buildx build \
"${DOCKER_ARGS[@]}" \
--progress plain \
--tag "vertexproject/synapse:${TAG}" \
--file docker/images/synapse/Dockerfile \
--load \
.

docker/build_image.sh aha "${TAG}"
docker/build_image.sh axon "${TAG}"
docker/build_image.sh cortex "${TAG}"
docker/build_image.sh cryotank "${TAG}"
docker/build_image.sh jsonstor "${TAG}"
docker/build_image.sh stemcell "${TAG}"
51 changes: 39 additions & 12 deletions docker/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,57 @@
# A second argument may be provided, including the tag to build.
# A default tag will be used if one is not provided.
#
# This will build a base image, if it does not exist, using the
# ./docker/build_base.sh script.
#
##############################################################################

set -e # exit on nonzero
set -u # undefined variables
set -o pipefail # pipefail propagate error codes
# set -x # debugging

IMAGE=${1:-}
if [ ${IMAGE} == "synapse" ]
IMAGE="${1:-}"
if [ "${IMAGE}" == "synapse" ]
then
echo "The vertexproject/synapse image is not built with this script."
false
fi
IMAGE_DIR=docker/images/${IMAGE}
[ ! -d $IMAGE_DIR ] && echo "$IMAGE_DIR does not exist." && false

TAG=${2:-}
IMAGE_DIR="docker/images/${IMAGE}"
[ ! -d "${IMAGE_DIR}" ] && echo "${IMAGE_DIR} does not exist." && false

TAG="${2:-}"
[ -z "${TAG}" ] && echo "Tag not provided, defaulting tag to dev_build" && TAG="dev_build"

declare -a DOCKER_ARGS

# When building locally, a developer can override the base image via
# SYN_BUILD_BASE_IMAGE="my_awesome_synapse_image" ./docker/build_image.sh cortex
[ -n "${SYN_BUILD_BASE_IMAGE:-}" ] && DOCKER_ARGS+=('--build-arg' "BASE=${SYN_BUILD_BASE_IMAGE}")

[ ! $TAG ] && echo "Tag not provided, defaulting tag to dev_build" && TAG=dev_build
# By default the script will always pull the newest base image from the registry.
# This way, once a new base image is updated in the registry, the release
# process will ensure the new base is used. When building locally, a developer
# might want to try a custom base image without uploading it first, and this
# behaviour will lead to a failure. The developer can disable image pulling by
# SYN_BUILD_PULL=0 ./docker/build_image.sh cortex
[ "${SYN_BUILD_PULL:-1}" != "0" ] && DOCKER_ARGS+=('--pull')

# By default the script will disable cache during builds for stable CI
# behaviour. When building locally, a developer might speed things up:
# SYN_BUILD_USE_CACHE=1 ./docker/build_image.sh cortex
[ "${SYN_BUILD_USE_CACHE:-}" != "1" ] && DOCKER_ARGS+=('--no-cache')

# To build locally on post-M1 Mac's with new docker, the following might be required:
# SYN_BUILD_PLATFORM="linux/amd64" ./docker/build_image.sh cortex
[ -n "${SYN_BUILD_PLATFORM:-}" ] && DOCKER_ARGS+=('--platform' "${SYN_BUILD_PLATFORM}")

# Build target image
echo "Building from docker/images/$IMAGE/Dockerfile"
docker builder prune -a -f
docker build --no-cache --progress plain --pull -t vertexproject/synapse-$IMAGE:$TAG -f docker/images/$IMAGE/Dockerfile .
echo "Building from docker/images/${IMAGE}/Dockerfile"
[ "${SYN_BUILD_USE_CACHE:-}" != "1" ] && docker builder prune --all --force

docker buildx build \
"${DOCKER_ARGS[@]}" \
--progress plain \
--tag "vertexproject/synapse-${IMAGE}:${TAG}" \
--file "docker/images/${IMAGE}/Dockerfile" \
--load \
.
12 changes: 8 additions & 4 deletions docker/images/aha/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/aha/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/aha/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/

11 changes: 7 additions & 4 deletions docker/images/axon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/axon/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/axon/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
11 changes: 7 additions & 4 deletions docker/images/cortex/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/cortex/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/cortex/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
11 changes: 7 additions & 4 deletions docker/images/cryotank/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/cryotank/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/cryotank/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
11 changes: 7 additions & 4 deletions docker/images/jsonstor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/jsonstor/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/jsonstor/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
11 changes: 7 additions & 4 deletions docker/images/stemcell/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# vim:set ft=dockerfile:
FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh
COPY docker/images/stemcell/entrypoint.sh /vertex/synapse/entrypoint.sh

RUN /build/synapse/bootstrap.sh

COPY docker/images/stemcell/entrypoint.sh /vertex/synapse/entrypoint.sh

EXPOSE 4443
EXPOSE 27492

VOLUME /vertex/storage

ENTRYPOINT ["tini", "--", "/vertex/synapse/entrypoint.sh"]

HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
HEALTHCHECK --start-period=10s --retries=1 --timeout=10s --interval=30s \
CMD python -m synapse.tools.healthcheck -c cell:///vertex/storage/
8 changes: 5 additions & 3 deletions docker/images/synapse/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
# synapse and its dependencies pre-installed. It does not start any
# services.

FROM vertexproject/vtx-base-image:py311
ARG BASE="vertexproject/vtx-base-image:py311"

ENV SYN_LOG_LEVEL="INFO"
FROM ${BASE}

COPY synapse /build/synapse/synapse
COPY README.rst /build/synapse/README.rst
COPY pyproject.toml /build/synapse/pyproject.toml

COPY docker/rmlist.txt /build/synapse/rmlist.txt
COPY docker/bootstrap.sh /build/synapse/bootstrap.sh

RUN /build/synapse/bootstrap.sh

ENV SYN_LOG_LEVEL="INFO"

VOLUME /vertex/storage
Loading