Skip to content

Commit

Permalink
use placeholder for the chainguard
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed May 15, 2024
1 parent 1bb262f commit 8509876
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .buildkite/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ notify:
env:
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2004"
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"
GENERATE_WOLFI_IMAGES: "true"
GENERATE_CHAINGUARD_IMAGES: "true"

steps:
- group: "Package"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
env:
GENERATE_WOLFI_IMAGES: true
GENERATE_CHAINGUARD_IMAGES: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
20 changes: 11 additions & 9 deletions packaging.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ DOCKER_IMAGES := \
build/docker/apm-server-ubi-$(APM_SERVER_VERSION).txt \
build/docker/apm-server-ubi-$(APM_SERVER_VERSION)-SNAPSHOT.txt

# If GENERATE_WOLFI_IMAGES is set then generate wolfi docker images.
ifdef GENERATE_WOLFI_IMAGES
# If GENERATE_CHAINGUARD_IMAGES is set then generate chainguard docker images.
ifdef GENERATE_CHAINGUARD_IMAGES
DOCKER_IMAGES := $(DOCKER_IMAGES) \
build/docker/apm-server-wolfi-$(APM_SERVER_VERSION).txt \
build/docker/apm-server-wolfi-$(APM_SERVER_VERSION)-SNAPSHOT.txt
build/docker/apm-server-chainguard-$(APM_SERVER_VERSION).txt \
build/docker/apm-server-chainguard-$(APM_SERVER_VERSION)-SNAPSHOT.txt
endif

build/docker/%.txt: DOCKER_IMAGE_TAG := docker.elastic.co/apm/apm-server:%
build/docker/%.txt: VERSION := $(APM_SERVER_VERSION)
build/docker/%.txt: DOCKER_IMAGE := -f packaging/docker/Dockerfile
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
build/docker/apm-server-chainguard-%.txt: DOCKER_IMAGE := -f packaging/docker/Dockerfile.chainguard

INTERNAL_DOCKER_IMAGE := docker.elastic.co/observability-ci/apm-server-internal

Expand All @@ -53,15 +54,16 @@ $(DOCKER_IMAGES):
--build-arg GOLANG_VERSION=$(GOLANG_VERSION) \
--build-arg VERSION=$(VERSION) \
$(DOCKER_BUILD_ARGS) \
--tag $(INTERNAL_DOCKER_IMAGE):$(VERSION)$(if $(findstring arm64,$(GOARCH)),-arm64)$(if $(findstring wolfi,$(@)),-wolfi) \
--file $(DOCKER_IMAGE) \
--tag $(INTERNAL_DOCKER_IMAGE):$(VERSION)$(if $(findstring arm64,$(GOARCH)),-arm64)$(if $(findstring chainguard,$(@)),-chainguard) \
-f packaging/docker/Dockerfile .

# Docker image tarballs. We distribute UBI Docker images only for AMD64.
DOCKER_IMAGE_SUFFIX := docker-image$(if $(findstring arm64,$(GOARCH)),-arm64).tar.gz
DOCKER_IMAGE_PREFIXES := apm-server $(if $(findstring amd64,$(GOARCH)), apm-server-ubi)
# If GENERATE_WOLFI_IMAGES is set then generate wolfi docker images.
ifdef GENERATE_WOLFI_IMAGES
DOCKER_IMAGE_PREFIXES := $(DOCKER_IMAGE_PREFIXES) apm-server-wolfi
# If GENERATE_CHAINGUARD_IMAGES is set then generate chainguard docker images.
ifdef GENERATE_CHAINGUARD_IMAGES
DOCKER_IMAGE_PREFIXES := $(DOCKER_IMAGE_PREFIXES) apm-server-chainguard
endif
DOCKER_IMAGE_RELEASE_TARBALLS := $(patsubst %, $(DISTDIR)/%-$(APM_SERVER_VERSION)-$(DOCKER_IMAGE_SUFFIX), $(DOCKER_IMAGE_PREFIXES))
DOCKER_IMAGE_SNAPSHOT_TARBALLS := $(patsubst %, $(DISTDIR)/%-$(APM_SERVER_VERSION)-SNAPSHOT-$(DOCKER_IMAGE_SUFFIX), $(DOCKER_IMAGE_PREFIXES))
Expand Down
5 changes: 2 additions & 3 deletions packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
ARG BASE_IMAGE=ubuntu:22.04
ARG BASE_GOLANG_IMAGE=golang
ARG GOLANG_VERSION

################################################################################
# Build stage 0
# Build the apm-server binary. The golang image version is kept
# up to date with go.mod by Makefile.
################################################################################
FROM ${BASE_GOLANG_IMAGE}:${GOLANG_VERSION} as builder
FROM golang:${GOLANG_VERSION} as builder
WORKDIR /src
COPY go.mod go.sum .go-version /src/
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/
COPY cmd /src/cmd
COPY internal /src/internal
COPY x-pack /src/x-pack
Expand Down
2 changes: 2 additions & 0 deletions packaging/docker/Dockerfile.chainguard
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM docker.elastic.co/wolfi/chainguard-base:20230214
RUN echo 'TBC'

0 comments on commit 8509876

Please sign in to comment.