Skip to content

feat(docker): Switch to a distroless base image #4940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ jobs:
matrix:
image_name: ["relay"] # Don't publish relay-pop (for now)

if: github.event_name == 'merge_group'
if: github.event_name == 'merge_group'

env:
GHCR_DOCKER_IMAGE: "ghcr.io/getsentry/${{ matrix.image_name }}"
Expand Down Expand Up @@ -854,6 +854,13 @@ jobs:
image_url: ghcr.io/getsentry/relay:${{ github.event.pull_request.head.sha || github.sha }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Inspect failure
if: failure()
run: |
cd /home/runner/work/_actions/getsentry/self-hosted/master
docker compose ps
docker compose logs
Comment on lines +857 to +862
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BYK when you get back, I think this would better be included on the self-hosted e2e test action?


validate-devservices-config:
runs-on: ubuntu-24.04
needs: devservices-files-changed
Expand Down
34 changes: 12 additions & 22 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
FROM debian:bookworm-slim
FROM gcr.io/distroless/cc-debian12:debug AS builder

ARG TARGETPLATFORM

RUN apt-get update \
&& apt-get install -y ca-certificates gosu curl --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN ["/busybox/busybox", "mkdir", "/work", "/etc/relay"]

ENV \
RELAY_UID=10001 \
RELAY_GID=10001

# Create a new user and group with fixed uid/gid
RUN groupadd --system relay --gid $RELAY_GID \
&& useradd --system --gid relay --uid $RELAY_UID relay
FROM gcr.io/distroless/cc-debian12:nonroot

RUN mkdir /work /etc/relay \
&& chown relay:relay /work /etc/relay
VOLUME ["/work", "/etc/relay"]
WORKDIR /work
ARG TARGETPLATFORM

EXPOSE 3000

COPY $TARGETPLATFORM/relay /bin/relay
RUN chmod +x /bin/relay
COPY --from=builder --chown=nonroot:noonroot /etc/relay /etc/relay
COPY --from=builder --chown=nonroot:noonroot /work /work

COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"]
CMD ["run"]
VOLUME ["/etc/relay", "/work"]
WORKDIR /work

COPY --chmod=755 $TARGETPLATFORM/relay /bin/relay

ENTRYPOINT ["/bin/relay"]
CMD ["run"]
51 changes: 0 additions & 51 deletions docker-entrypoint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion relay-kafka/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ publish = false
workspace = true

[dependencies]
rdkafka = { workspace = true, optional = true, features = ["tracing", "ssl"] }
rdkafka = { workspace = true, optional = true, features = ["tracing", "ssl", "libz-static"] }
rdkafka-sys = { workspace = true, optional = true }
relay-log = { workspace = true, optional = true }
relay-statsd = { workspace = true, optional = true }
Expand Down
Loading