Skip to content

Commit

Permalink
ci: push to quay
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-jones committed Jun 14, 2024
1 parent 16a1ee8 commit 0c0d208
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/merge-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and push Docker image

on:
push:
branches:
- master

jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
with:
version: v0.11.2

- name: Restore build cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-${{ github.ref_name }}-cache
key: ${{ runner.os }}-buildx-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-buildx-${{ github.ref_name }}
- name: Build and push
run: |
make push
env:
BRANCH_NAME: ${{ github.ref_name }}
RELEASE_ID: ${{ github.run_number }}
GIT_HASH: ${{ github.sha }}
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
DOCKER_REPOSITORY ?= quay.io/road
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
GIT_HASH ?= $(shell git rev-parse HEAD)
RELEASE_ID ?= $(shell id -un)-local
DOCKER_LATEST_TAG ?= latest

build:
DOCKER_BUILDKIT=1 DOCKER_SCAN_SUGGEST=false docker build -t e-flux-tools-mongo-backup:latest -f Dockerfile --platform=linux/amd64 .
docker tag e-flux-tools-mongo-backup:latest europe-west3-docker.pkg.dev/eflux-staging/docker/e-flux-tools-mongo-backup:latest
docker tag e-flux-tools-mongo-backup:latest europe-west3-docker.pkg.dev/eflux-production/docker/e-flux-tools-mongo-backup:latest
docker buildx build \
--cache-from type=local,src=/tmp/.buildx-$(BRANCH_NAME)-mongodb-backups-cache \
--cache-to type=local,mode=max,dest=/tmp/.buildx-$(BRANCH_NAME)-mongodb-backups-cache \
--provenance mode=min,inline-only=true \
--tag $(DOCKER_REPOSITORY)/mongodb-backups:$(GIT_HASH) \
--tag $(DOCKER_REPOSITORY)/mongodb-backups:$(DOCKER_LATEST_TAG) \
--tag $(DOCKER_REPOSITORY)/mongodb-backups:release-$(RELEASE_ID) \
--push \
.

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

0 comments on commit 0c0d208

Please sign in to comment.