-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (39 loc) · 1.13 KB
/
build-and-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Build and Push to GCR
on:
push:
branches:
- main
paths:
- "backend/**"
env:
REGION: europe-west2
PROJECT: dojodraw
REPO: dojodraw-backend
IMAGE: dojodraw-backend
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up variables
run: echo "IMAGE_TAG=$REGION-docker.pkg.dev/$PROJECT/$REPO/$IMAGE" >> $GITHUB_ENV
- name: Google Cloud Auth
uses: google-github-actions/auth@v1
with:
credentials_json: "${{ secrets.GC_IMAGE_MANAGER_KEY }}"
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Docker auth
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ env.IMAGE_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max