Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Properly set metadata in multi-arch images (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
nacx authored Mar 7, 2024
1 parent a633844 commit c93146a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,5 @@ ARG TARGETOS
ARG REPO
ARG FLAVOR

LABEL org.opencontainers.image.source=${REPO}
LABEL org.opencontainers.image.description="Move OIDC token acquisition out of your app code and into the Istio mesh"
LABEL org.opencontainers.image.licenses="Apache-2.0"

ADD bin/authservice-${FLAVOR}-${TARGETOS}-${TARGETARCH} /usr/local/bin/authservice
ENTRYPOINT ["/usr/local/bin/authservice"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ docker/%: $(OUTDIR)/$(NAME)-$$(FLAVOR)-$$(notdir %)
--platform $(PLATFORM) \
--build-arg REPO=https://$(GO_MODULE) \
--build-arg FLAVOR=$(FLAVOR) \
$(subst org.,--label org.,$(DOCKER_METADATA)) \
-t $(DOCKER_HUB)/$(NAME):latest-$(DOCKER_ARCH)$(TAG_SUFFIX) \
-t $(DOCKER_HUB)/$(NAME):$(DOCKER_TAG)-$(DOCKER_ARCH)$(TAG_SUFFIX) \
.
Expand All @@ -182,6 +183,8 @@ docker-push/%:
--platform $(PLATFORMS) \
--build-arg REPO=https://$(GO_MODULE) \
--build-arg FLAVOR=$(@F) \
$(subst org.,--label org.,$(DOCKER_METADATA)) \
$(subst org.,--annotation index:org.,$(DOCKER_METADATA)) \
-t $(DOCKER_HUB)/$(NAME):$(DOCKER_TAG)$(TAG_SUFFIX) \
.

Expand Down
12 changes: 11 additions & 1 deletion env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@ export DOCKER_HUB ?= $(GO_MODULE:github.com/%=ghcr.io/%)
DOCKER_TARGETS ?= linux-amd64 linux-arm64
DOCKER_BUILDER_NAME ?= $(NAME)-builder

REVISION := $(shell git rev-parse HEAD)
ifneq ($(strip $(VERSION)),)
# Remove the suffix as we want N.N.N instead of vN.N.N
DOCKER_TAG ?= $(strip $(VERSION:v%=%))
else
DOCKER_TAG ?= $(shell git rev-parse HEAD)
DOCKER_TAG ?= $(REVISION)
endif

# Docker metadata
DOCKER_METADATA := \
org.opencontainers.image.title=$(NAME) \
org.opencontainers.image.description="Move OIDC token acquisition out of your app code and into the Istio mesh" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.source=https://$(GO_MODULE) \
org.opencontainers.image.version=$(DOCKER_TAG) \
org.opencontainers.image.revision=$(REVISION)

# In non-Linux systems, use Docker to build FIPS-compliant binaries.
OS := $(shell uname)
ifeq ($(OS),Darwin)
Expand Down

0 comments on commit c93146a

Please sign in to comment.