Skip to content

Commit

Permalink
chore: Dockerfile: build browser image from chromium-swiftshader-alpine
Browse files Browse the repository at this point in the history
The new base image is built at
https://github.com/grafana/chromium-swiftshader-alpine, and should allow
us to both get chromium updates as PRs, while at the same time being
stable so an outdated version does not break builds in the foreseeable
future.
  • Loading branch information
nadiamoe authored and Nadia Santalla committed Nov 26, 2024
1 parent f06717a commit b8ff6ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
17 changes: 3 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ RUN apk --no-cache add ca-certificates-bundle
# Second stage copies the binaries, configuration and also the
# certificates from the first stage.

ARG TARGETPLATFORM

FROM --platform=$TARGETPLATFORM alpine:3.20.3 AS release
FROM alpine:3.20.3 AS release
ARG TARGETOS
ARG TARGETARCH
ARG HOST_DIST=$TARGETOS-$TARGETARCH
Expand All @@ -21,18 +19,9 @@ ENTRYPOINT ["/usr/local/bin/synthetic-monitoring-agent"]

# Third stage copies the setup from the base agent and
# additionally installs Chromium to support browser checks.
FROM --platform=$TARGETPLATFORM alpine:3.20.3 AS with-browser

ARG TARGETARCH
FROM ghcr.io/grafana/chromium-swiftshader-alpine:131.0.6778.85-r0-3.20.3 AS with-browser

# Renovate updates the pinned packages below.
# The --repository arg is required for renovate to know which alpine repo it should look for updates in.
# To keep the renovate regex simple, only keep one package installation per line.
# Furthermore, we split this into two lines to allow for the arm64 and amd64 versions of chromium to be different, as
# they have drifted in the past.
RUN apk --no-cache add --repository community tini=0.19.0-r3
RUN [[ "$TARGETARCH" != "amd64" ]] || apk --no-cache add --repository community --arch x86_64 chromium-swiftshader=131.0.6778.69-r0
RUN [[ "$TARGETARCH" != "arm64" ]] || apk --no-cache add --repository community --arch aarch64 chromium-swiftshader=131.0.6778.69-r0
RUN apk --no-cache add --repository community tini

COPY --from=release /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
COPY --from=release /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
Expand Down
16 changes: 2 additions & 14 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,9 @@ ENTRYPOINT ["/usr/local/bin/synthetic-monitoring-agent"]

# Third stage copies the setup from the base agent and
# additionally installs Chromium to support browser checks.
FROM alpine:3.20.3 AS with-browser
ARG TARGETOS
ARG TARGETARCH
FROM ghcr.io/grafana/chromium-swiftshader-alpine:131.0.6778.85-r0-3.20.3 AS with-browser

# Renovate updates the pinned packages below.
# The --repository arg is required for renovate to know which alpine repo it should look for updates in.
# The --arch flag is necessary so that it knows which architecture to target.
# To keep the renovate regex simple, only keep one package installation per line.
#
# Alpine does not have a consistent set of packages across all the
# architectures, so we have to install different versions depending on which
# one we are targeting.
RUN apk --no-cache add --repository community tini=0.19.0-r3
RUN if test "$TARGETARCH" = "amd64" ; then apk --no-cache add --repository community --arch x86_64 chromium-swiftshader=131.0.6778.69-r0 ; fi
RUN if test "$TARGETARCH" = "arm64" ; then apk --no-cache add --repository community --arch aarch64 chromium-swiftshader=131.0.6778.69-r0 ; fi
RUN apk --no-cache add --repository community tini

COPY --from=release /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
COPY --from=release /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
Expand Down

0 comments on commit b8ff6ad

Please sign in to comment.