-
Notifications
You must be signed in to change notification settings - Fork 523
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
build and push Docker image based on Chainguard base image #13137
Conversation
this will help with pushing docker images to the internal docker registry and test this out
@@ -186,7 +196,10 @@ build/dependencies-$(APM_SERVER_VERSION)-SNAPSHOT.csv: build/dependencies-$(APM_ | |||
cp $< $@ | |||
|
|||
package-docker: $(DOCKER_IMAGE_RELEASE_TARBALLS) | |||
@echo ">> $(DOCKER_IMAGE_RELEASE_TARBALLS)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to help with printing what it did
package-docker-snapshot: $(DOCKER_IMAGE_SNAPSHOT_TARBALLS) | ||
@echo ">> $(DOCKER_IMAGE_SNAPSHOT_TARBALLS)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to help with printing what it did
--tag $(INTERNAL_DOCKER_IMAGE):$(VERSION)$(if $(findstring arm64,$(GOARCH)),-arm64)$(if $(findstring wolfi,$(@)),-wolfi) \ | ||
-f packaging/docker/Dockerfile . | ||
|
||
# Docker image tarballs. We distribute UBI Docker images only for AMD64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs: no ubi8
but ubi
, #11977
|
||
build/docker/%.txt: DOCKER_IMAGE_TAG := docker.elastic.co/apm/apm-server:% | ||
build/docker/%.txt: VERSION := $(APM_SERVER_VERSION) | ||
build/docker/%-SNAPSHOT.txt: VERSION := $(APM_SERVER_VERSION)-SNAPSHOT | ||
build/docker/apm-server-ubi-%.txt: DOCKER_BUILD_ARGS+=--build-arg BASE_IMAGE=docker.elastic.co/ubi9/ubi-minimal | ||
build/docker/apm-server-wolfi-%.txt: DOCKER_BUILD_ARGS+=--build-arg BASE_IMAGE=docker.elastic.co/wolfi/chainguard-base:20230214 --build-arg BASE_GOLANG_IMAGE=docker.elastic.co/wolfi/go | ||
|
||
INTERNAL_DOCKER_IMAGE := docker.elastic.co/observability-ci/apm-server-internal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should help create docker images and publish them to our internal docker registry - this is handy for validating changes before anything related to the DRA and in GitHub actions.
We are safe since these docker images won't be public available for the time being:
$ docker pull docker.elastic.co/observability-ci/apm-server-internal:8.15.0-SNAPSHOT-wolfi
Error response from daemon: pull access denied for docker.elastic.co/observability-ci/apm-server-internal, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
WORKDIR /src | ||
COPY go.mod go.sum /src/ | ||
COPY go.mod go.sum .go-version /src/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a warning when building the docker image
COPY internal/glog/go.mod /src/internal/glog/go.mod | ||
RUN --mount=type=cache,target=/go/pkg/mod go mod download | ||
COPY Makefile *.mk /src | ||
COPY cmd /src/cmd | ||
COPY internal /src/internal | ||
COPY x-pack /src/x-pack | ||
COPY .git /src/.git | ||
COPY script /src/script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes a warning when building the docker image
|
||
ENV GOROOT /usr/local/go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrequired for building the wolfi version and in fact it's not needed for the traditional docker image
- run: make package-snapshot | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove some warnings in the github logs, regarding missing variable when running gh in the GitHub runner
.github/workflows/ci.yml
Outdated
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
if: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only when working on branches in the upstream or PRs coming from the upstream then login, GitHub secrets are not available on forked PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use chainguard static image as apm-server is a static go binary now
Would you agree that changing this PR to support a vanilla
Changes will be about:
|
That works 😄 |
COPY internal/glog/go.mod /src/internal/glog/go.mod | ||
RUN --mount=type=cache,target=/go/pkg/mod go mod download | ||
COPY Makefile *.mk /src | ||
COPY Makefile *.mk /src/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed linting, when copy multiple files then the target should end with /
@v1v can you sign the commits ? |
(cherry picked from commit b070b3c)
…13225) (cherry picked from commit b070b3c) Co-authored-by: Victor Martinez <[email protected]>
…impler * upstream/main: (28 commits) chore: Update to elastic/beats@19499ae5ab94 (elastic#13240) [updatecli] Bump elastic stack version to 8.15.0-561c6014 (elastic#13241) buildkite: create chainguard images (elastic#13226) chore: Update to elastic/beats@d5bfebb8940d (elastic#13231) [updatecli] Bump elastic stack version to 8.15.0-04e5793a (elastic#13227) build and push Docker image based on Chainguard base image (elastic#13137) buildkite(dra): support list for feature branches (elastic#13139) [updatecli] Bump elastic stack version to 8.15.0-e7873a67 (elastic#13218) chore: Update to elastic/beats@2419622b1b33 (elastic#13220) build(deps): bump the otel group with 3 updates (elastic#13213) [updatecli] Bump elastic stack version to 8.15.0-21ea2af3 (elastic#13206) chore: Update to elastic/beats@4a670391a6e2 (elastic#13209) build(deps): bump github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger from 0.100.0 to 0.101.0 in the jaeger group (elastic#13214) build(deps): bump the otel group with 2 updates (elastic#13205) Depend on apm-data plugin (elastic#12066) chore: Update to elastic/beats@d8072923498c (elastic#13203) [updatecli] Bump elastic stack version to 8.15.0-9bce1e63 (elastic#13200) build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.10.1 to 0.10.2 (elastic#13195) chore: Update to elastic/beats@062cc9b191b5 (elastic#13190) [updatecli] Bump elastic stack version to 8.15.0-1a872dbc (elastic#13185) ...
Motivation/summary
Release two flavours of Docker images:
Please note that we are going to preserve the current
Dockerfile
, so that users will still be able to build their own custom images based onubuntu
: this is needed becausedocker.elastic.co/wolfi/*
is not a public base image, so docker build would fail for unauthenticated users.Implementation details
I changed the Makefiles to support different Dockerfiles when running the docker build generation.
I added a tag for helping testing this in GitHub actions and then be able to push the docker images to an internal docker registry.
I fixed some warning regarding missing files when running the go build in the docker.
Checklist
For functional changes, consider:
How to test these changes
CI
Will create the docker images automatically when working on a feature branch or main/releases
Locally
TBC what kind of tests should be done and how.
Related issues
#13139 will help with testing these changes in Buildkite without the need to be merged.
#12671 is also another in-progress task