Skip to content

Commit

Permalink
Add manifest to workflow, and add arch to DATE tags
Browse files Browse the repository at this point in the history
  • Loading branch information
crunchyheath committed Jan 25, 2024
1 parent adf76cc commit 64eace2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ jobs:
if: github.repository == 'CrunchyData/pg_featureserv'
steps:

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x

- name: Checkout
uses: actions/checkout@v3

- name: Build
run: make build && make docker
- name: Build ARM64
run: make TARGETARCH=arm64 multi-stage-docker

- name: Build x86_64
run: make TARGETARCH=amd64 multi-stage-docker

- name: Docker Upload
env:
Expand All @@ -29,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 featureserv | 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 @@ -7,7 +7,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 @@ -26,7 +26,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 @@ -46,7 +47,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 @@ -74,10 +75,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=featureservbuilder -f

set-local:
Expand Down

0 comments on commit 64eace2

Please sign in to comment.