-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework build_and_publish.yaml to handle docker images (#951)
- Loading branch information
Showing
9 changed files
with
151 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM --platform=$TARGETOS/$TARGETARCH scratch | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ADD ./dist/container-image.browser.${TARGETOS}-${TARGETARCH}.tar / | ||
|
||
ENV K6_BROWSER_ARGS=no-sandbox,disable-dev-shm-usage | ||
|
||
ENTRYPOINT ["tini", "--", "/usr/local/bin/synthetic-monitoring-agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# First stage obtains the list of certificates. | ||
FROM --platform=$BUILDPLATFORM alpine:3.20.3 AS build | ||
RUN apk --no-cache add ca-certificates-bundle | ||
|
||
# Second stage copies the binaries, configuration and also the | ||
# certificates from the first stage. | ||
|
||
FROM alpine:3.20.3 AS release | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG HOST_DIST=$TARGETOS-$TARGETARCH | ||
|
||
COPY dist/${HOST_DIST}/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent | ||
COPY dist/${HOST_DIST}/k6 /usr/local/bin/sm-k6 | ||
COPY scripts/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
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 | ||
|
||
# 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. | ||
RUN apk --no-cache add --repository community tini=0.19.0-r3 | ||
RUN apk --no-cache add --repository community chromium-swiftshader=130.0.6723.58-r0 | ||
|
||
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 | ||
COPY --from=release /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh | ||
COPY --from=release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt | ||
|
||
ENV K6_BROWSER_ARGS=no-sandbox,disable-dev-shm-usage | ||
|
||
ENTRYPOINT ["tini", "--", "/usr/local/bin/synthetic-monitoring-agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM --platform=$TARGETOS/$TARGETARCH scratch | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ADD ./dist/container-image.no-browser.${TARGETOS}-${TARGETARCH}.tar / | ||
|
||
ENTRYPOINT ["/usr/local/bin/synthetic-monitoring-agent"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -u | ||
|
||
image_name=$1 | ||
output=$2 | ||
|
||
container_id=$(docker container create "${image_name}") | ||
trap 'docker container rm "${container_id}"' EXIT | ||
docker container export -o "${output}" "${container_id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
data=$(mktemp) | ||
trap 'rm -f $data' EXIT | ||
|
||
cat "$1" > "$data" | ||
|
||
echo "image=$(jq -r '.target["docker-metadata-action"].args.DOCKER_META_IMAGES' < "$data")" | ||
echo "tag=$(jq -r '.target["docker-metadata-action"].args.DOCKER_META_VERSION' < "$data")" |