From d4f7bb3ed2b59d87ddabf5975d080205323c2acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20B=C3=A4ck?= Date: Thu, 4 May 2023 08:11:24 +0200 Subject: [PATCH] Set labels on the Docker image (#57) To improve traceability of our Docker image and add other useful metadata let's set a few OCI labels, plus a Datadog label to make life easier for users of Datadog without impacting others. There no foolproof way of detecting the repository we're building from so the repository URL is unfortunately hardcoded. --- Makefile | 2 +- deploy/goer/Dockerfile | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a085e46..aa483cf 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ stop: # Build a docker using the production Dockerfile .PHONY: docker docker: - docker build -t $(DOCKER_REGISTRY)/$(DEPLOY):$(RELEASE_VERSION) -f ./deploy/$(DEPLOY)/Dockerfile . + docker build --build-arg revision=$(RELEASE_VERSION) -t $(DOCKER_REGISTRY)/$(DEPLOY):$(RELEASE_VERSION) -f ./deploy/$(DEPLOY)/Dockerfile . .PHONY: push push: diff --git a/deploy/goer/Dockerfile b/deploy/goer/Dockerfile index 7c2e288..1424251 100644 --- a/deploy/goer/Dockerfile +++ b/deploy/goer/Dockerfile @@ -9,3 +9,9 @@ RUN make build FROM alpine:3.13.5 ENTRYPOINT ["/app/goer"] COPY --from=build /tmp/goer/bin/goer /app/goer + +ARG revision +LABEL com.datadoghq.tags.version="${revision}" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.revision="${revision}" \ + org.opencontainers.image.source="https://github.com/eiffel-community/eiffel-goer"