Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ jobs:
command: |
ROUTER_TAG=ghcr.io/apollographql/router
# Build debug image
docker build --build-arg ROUTER_RELEASE=${VERSION} --build-arg DEBUG_IMAGE=":debug" -f dockerfiles/Dockerfile.router -t ${ROUTER_TAG}:${VERSION}-debug .
docker build --build-arg ROUTER_RELEASE=${VERSION} -f dockerfiles/Dockerfile.router -t ${ROUTER_TAG}:${VERSION}-debug .
# Build release image
docker build --build-arg ROUTER_RELEASE=${VERSION} -f dockerfiles/Dockerfile.router -t ${ROUTER_TAG}:${VERSION} .
# Note: GH Token owned by apollo-bot2, no expire
Expand Down
9 changes: 9 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ By [@garypen](https://github.com/garypen) and [@Geal](https://github.com/Geal) i

## 🐛 Fixes
## 🛠 Maintenance

### Use debian:bullseye-slim as our base docker image ([PR #2085](https://github.com/apollographql/router/pull/2085))

A while ago, when we added compression support to the router, we discovered that distroless doesn't ship with a copy of `libz.so.1`. We addressed that problem by copying in a version of the library from a distroless image (java) which does ship it. That was ugly. Now, as we try to consider how to add support for both aarch64 and amd64 docker images, that ugliness would expand substantially.

Rather than persist with this complexity, we've concluded that it would be better to just use a base image which ships with `libz.so.1`, hence the change to `debian:bullseye-slim`

By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/2085

Comment thread
garypen marked this conversation as resolved.
## 📚 Documentation
18 changes: 1 addition & 17 deletions dockerfiles/Dockerfile.router
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
ARG DEBUG_IMAGE
# Build is required to extract the release files
FROM --platform=linux/amd64 debian:bullseye-slim AS build
FROM debian:bullseye-slim

ARG ROUTER_RELEASE=latest

Expand All @@ -22,23 +20,9 @@ RUN mkdir config schema
# Copy configuration for docker image
COPY dockerfiles/router.yaml config

# Required so we can copy in libz.so.1
FROM --platform=linux/amd64 gcr.io/distroless/java17-debian11${DEBUG_IMAGE} as libz-required

# Final image uses distroless
FROM --platform=linux/amd64 gcr.io/distroless/cc-debian11${DEBUG_IMAGE}

LABEL org.opencontainers.image.authors="Apollo Graph, Inc. https://github.com/apollographql/router"
LABEL org.opencontainers.image.source="https://github.com/apollographql/router"

# Copy in the extracted/created files
COPY --from=libz-required /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1

WORKDIR /dist

# Copy in the extracted/created files
COPY --from=build --chown=root:root /dist .

ENV APOLLO_ROUTER_CONFIG_PATH="/dist/config/router.yaml"

# Default executable is the router
Expand Down
8 changes: 5 additions & 3 deletions dockerfiles/diy/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ fi
echo "Building in: ${BUILD_DIR}"

# Copy in our dockerfiles, we'll need them later
cp dockerfiles/* "${BUILD_DIR}" || terminate "Couldn't copy dockerfiles to ${BUILD_DIR}"
cp ../router.yaml "${BUILD_DIR}" || terminate "Couldn't copy ../router.yaml to ${BUILD_DIR}"
mkdir "${BUILD_DIR}/dockerfiles"
cp dockerfiles/Dockerfile.repo "${BUILD_DIR}" || terminate "Couldn't copy dockerfiles to ${BUILD_DIR}"
cp ../Dockerfile.router "${BUILD_DIR}" || terminate "Couldn't copy dockerfiles to ${BUILD_DIR}"
cp ../router.yaml "${BUILD_DIR}/dockerfiles" || terminate "Couldn't copy ../router.yaml to ${BUILD_DIR}"

# Change to our build directory
cd "${BUILD_DIR}" || terminate "Couldn't cd to ${BUILD_DIR}";
Expand All @@ -149,7 +151,7 @@ else
echo "Building image: ${ROUTER_VERSION}" from released version""
docker build -q -t "router:${ROUTER_VERSION}" \
--build-arg ROUTER_RELEASE="${ROUTER_VERSION}" \
--no-cache -f Dockerfile.release . \
--no-cache -f Dockerfile.router . \
|| terminate "Couldn't build router image"
fi

Expand Down
47 changes: 0 additions & 47 deletions dockerfiles/diy/dockerfiles/Dockerfile.release

This file was deleted.

14 changes: 4 additions & 10 deletions dockerfiles/diy/dockerfiles/Dockerfile.repo
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ RUN mkdir -p /dist/config && \
# Copy configuration for docker image
COPY dockerfiles/router.yaml /dist/config

# Required so we can copy in libz.so.1
FROM --platform=linux/amd64 gcr.io/distroless/java17-debian11 as libz-required
FROM debian:bullseye-slim

# Final image uses distroless. Feel free to change this to an image that suits your needs.
FROM gcr.io/distroless/cc-debian11

# Set a label for our image
LABEL org.opencontainers.image.authors="ApolloGraphQL https://github.com/apollographql/router"

# Copy in the extracted/created files
COPY --from=libz-required /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1
# Set labels for our image
LABEL org.opencontainers.image.authors="Apollo Graph, Inc. https://github.com/apollographql/router"
LABEL org.opencontainers.image.source="https://github.com/apollographql/router"

# Copy in the required files from our build image
COPY --from=build --chown=root:root /dist /dist
Expand Down