Skip to content

Commit

Permalink
Add arch to Date tag, add manifest push to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
crunchyheath committed Jan 25, 2024
1 parent 4888a39 commit 9c43e6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ jobs:
run: |
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
docker push --all-tags $DOCKER_REPO
docker manifest create $DOCKER_REPO:latest $DOCKER_REPO:latest-amd64 $DOCKER_REPO:latest-arm64
docker manifest push $DOCKER_REPO:latest
date_tag=$(docker images | grep tileserv | grep -v latest | grep -v arm64 | awk '{print $2}')
date_tag=${date_tag/-amd64/}
docker manifest create $DOCKER_REPO:${date_tag} $DOCKER_REPO:${date_tag}-amd64 $DOCKER_REPO:${date_tag}-arm64
docker manifest push $DOCKER_REPO:${date_tag}
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## BASE_REGISTRY - This is the registry to pull the base image from
## BASE_IMAGE - The base image to use for the final container
## TARGETARCH - The architecture the resulting image is based on and the binary is compiled for
## IMAGE_TAG - The container and tag to be applied to the container
## IMAGE_TAG - The tag to be applied to the container

APPVERSION ?= latest
GOVERSION ?= 1.21.6
Expand All @@ -28,7 +28,8 @@ TARGETARCH ?= arm64
PLATFORM=arm64
endif

IMAGE_TAG ?= $(CONTAINER):$(APPVERSION)-$(TARGETARCH)
IMAGE_TAG ?= $(APPVERSION)-$(TARGETARCH)
DATE_TAG ?= $(DATE)-$(TARGETARCH)

RM = /bin/rm
CP = /bin/cp
Expand All @@ -49,7 +50,7 @@ clean: ## This will clean all local build artifacts
$(info Cleaning project...)
@rm -f $(PROGRAM)
@rm -rf docs/*
@docker image inspect $(CONTAINER):$(APPVERSION) >/dev/null 2>&1 && docker rmi -f $(CONTAINER):$(APPVERSION) $(CONTAINER):$(DATE) || echo -n ""
@docker image inspect $(CONTAINER):$(IMAGE_TAG) >/dev/null 2>&1 && docker rmi -f $(shell docker images --filter label=release=latest --filter=reference="*featureserv:*" -q) || echo -n ""

docs: ## Generate docs
@rm -rf docs/* && cd hugo && hugo && cd ..
Expand Down Expand Up @@ -77,10 +78,10 @@ build-common: Dockerfile
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--label vendor="Crunchy Data" \
--label url="https://crunchydata.com" \
--label release="${APPVERSION}" \
--label release="$(APPVERSION)" \
--label org.opencontainers.image.vendor="Crunchy Data" \
--label os.version="7.7" \
-t $(IMAGE_TAG) -t $(CONTAINER):$(DATE) .
-t $(CONTAINER):$(IMAGE_TAG) -t $(CONTAINER):$(DATE_TAG) .
docker image prune --filter label=stage=tileservbuilder -f

set-local:
Expand Down

0 comments on commit 9c43e6b

Please sign in to comment.