Skip to content

Commit 0c0d208

Browse files
committed
ci: push to quay
1 parent 16a1ee8 commit 0c0d208

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

.github/workflows/merge-master.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and push Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
push:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Login to Quay
16+
uses: docker/login-action@v3
17+
with:
18+
registry: quay.io
19+
username: ${{ vars.DOCKER_USERNAME }}
20+
password: ${{ secrets.DOCKER_PASSWORD }}
21+
22+
- name: Set up Docker BuildX
23+
uses: docker/setup-buildx-action@v3
24+
with:
25+
version: v0.11.2
26+
27+
- name: Restore build cache
28+
uses: actions/cache@v3
29+
with:
30+
path: /tmp/.buildx-${{ github.ref_name }}-cache
31+
key: ${{ runner.os }}-buildx-${{ github.ref_name }}
32+
restore-keys: |
33+
${{ runner.os }}-buildx-${{ github.ref_name }}
34+
35+
- name: Build and push
36+
run: |
37+
make push
38+
env:
39+
BRANCH_NAME: ${{ github.ref_name }}
40+
RELEASE_ID: ${{ github.run_number }}
41+
GIT_HASH: ${{ github.sha }}

Makefile

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
DOCKER_REPOSITORY ?= quay.io/road
2+
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
3+
GIT_HASH ?= $(shell git rev-parse HEAD)
4+
RELEASE_ID ?= $(shell id -un)-local
5+
DOCKER_LATEST_TAG ?= latest
6+
17
build:
2-
DOCKER_BUILDKIT=1 DOCKER_SCAN_SUGGEST=false docker build -t e-flux-tools-mongo-backup:latest -f Dockerfile --platform=linux/amd64 .
3-
docker tag e-flux-tools-mongo-backup:latest europe-west3-docker.pkg.dev/eflux-staging/docker/e-flux-tools-mongo-backup:latest
4-
docker tag e-flux-tools-mongo-backup:latest europe-west3-docker.pkg.dev/eflux-production/docker/e-flux-tools-mongo-backup:latest
8+
docker buildx build \
9+
--cache-from type=local,src=/tmp/.buildx-$(BRANCH_NAME)-mongodb-backups-cache \
10+
--cache-to type=local,mode=max,dest=/tmp/.buildx-$(BRANCH_NAME)-mongodb-backups-cache \
11+
--provenance mode=min,inline-only=true \
12+
--tag $(DOCKER_REPOSITORY)/mongodb-backups:$(GIT_HASH) \
13+
--tag $(DOCKER_REPOSITORY)/mongodb-backups:$(DOCKER_LATEST_TAG) \
14+
--tag $(DOCKER_REPOSITORY)/mongodb-backups:release-$(RELEASE_ID) \
15+
--push \
16+
.
517

618
push: build
7-
docker push europe-west3-docker.pkg.dev/eflux-staging/docker/e-flux-tools-mongo-backup:latest
8-
docker push europe-west3-docker.pkg.dev/eflux-production/docker/e-flux-tools-mongo-backup:latest

0 commit comments

Comments
 (0)