forked from dominiek/mongodb-backups
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16a1ee8
commit 0c0d208
Showing
2 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |