Skip to content

Commit 59603f3

Browse files
committed
fix image tagging
1 parent 07b5782 commit 59603f3

2 files changed

Lines changed: 26 additions & 37 deletions

File tree

.github/workflows/docker.yml

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,30 @@ jobs:
1616
permissions:
1717
contents: read
1818
packages: write
19-
attestations: write
20-
id-token: write
21-
strategy:
22-
matrix:
23-
include:
24-
- image: server
25-
dockerfile: ./Dockerfile
26-
image-name: ${{ github.repository }}
27-
- image: client
28-
dockerfile: ./Dockerfile.client
29-
image-name: ${{ github.repository }}-client
3019
steps:
3120
- name: Checkout
3221
uses: actions/checkout@v4
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
3326
- name: Set up Docker Buildx
3427
uses: docker/setup-buildx-action@v3
28+
3529
- name: Login to Container Registry
3630
uses: docker/login-action@v3
3731
with:
3832
registry: ${{ env.REGISTRY }}
3933
username: ${{ github.actor }}
4034
password: ${{ secrets.GITHUB_TOKEN }}
41-
- name: Extract metadata (tags, labels)
42-
id: meta
43-
uses: docker/metadata-action@v5
44-
with:
45-
images: ${{ env.REGISTRY }}/${{ matrix.image-name }}
46-
tags: |
47-
type=ref,event=branch
48-
type=ref,event=pr
49-
type=semver,pattern={{raw}}
50-
type=raw,value=latest,enable={{is_default_branch}}
51-
- name: Build and push ${{ matrix.image }} image
52-
uses: docker/build-push-action@v5
53-
with:
54-
context: .
55-
file: ${{ matrix.dockerfile }}
56-
platforms: linux/amd64,linux/arm64
57-
push: true
58-
tags: ${{ steps.meta.outputs.tags }}
59-
labels: ${{ steps.meta.outputs.labels }}
60-
build-args: |
61-
VERSION=${{ github.ref_type == 'tag' && github.ref_name || 'dev' }}
62-
attestations: type=provenance,mode=max
63-
provenance: false
35+
36+
- name: Build and push Docker images
37+
run: |
38+
if [ "${{ github.event_name }}" == "pull_request" ]; then
39+
echo "Building images for PR (no push)"
40+
make docker-build
41+
make docker-build-client
42+
else
43+
echo "Building and pushing images"
44+
make docker-push
45+
fi

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test coverage coverage-html clean proxymock-mock run build build-client integration-test load-test http-test http-test-recording bump-major bump-minor bump-patch version docker-build docker-build-client tag release-patch release-minor release-major update-k8s
1+
.PHONY: test coverage coverage-html clean proxymock-mock run build build-client integration-test load-test http-test http-test-recording bump-major bump-minor bump-patch version docker-build docker-build-client docker-buildx-setup docker-push tag release-patch release-minor release-major update-k8s
22

33
# Define proxymock environment variables
44
PROXYMOCK_ENV = http_proxy=socks5h://localhost:4140 \
@@ -127,10 +127,17 @@ update-k8s:
127127
@echo "Updated k8s manifests to $(CURRENT_VERSION)"
128128

129129
docker-build:
130-
docker build --build-arg VERSION=$(CURRENT_VERSION) -t outerspace-go:$(CURRENT_VERSION) -t outerspace-go:latest .
130+
docker build --build-arg VERSION=$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go:$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go:latest .
131131

132132
docker-build-client:
133-
docker build --build-arg VERSION=$(CURRENT_VERSION) -f Dockerfile.client -t outerspace-client:$(CURRENT_VERSION) -t outerspace-client:latest .
133+
docker build --build-arg VERSION=$(CURRENT_VERSION) -f Dockerfile.client -t ghcr.io/speedscale/outerspace-go-client:$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go-client:latest .
134+
135+
docker-buildx-setup:
136+
docker buildx create --name outerspace-builder --use || docker buildx use outerspace-builder
137+
138+
docker-push: docker-buildx-setup
139+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go:$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go:latest --push .
140+
docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=$(CURRENT_VERSION) -f Dockerfile.client -t ghcr.io/speedscale/outerspace-go-client:$(CURRENT_VERSION) -t ghcr.io/speedscale/outerspace-go-client:latest --push .
134141

135142
tag:
136143
git tag $(CURRENT_VERSION)

0 commit comments

Comments
 (0)