-
Notifications
You must be signed in to change notification settings - Fork 25
62 lines (53 loc) · 1.61 KB
/
deploy-docker.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
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Publish Container Image
on:
push:
branches:
- main
env:
GH_REGISTRY: ghcr.io
GCP_REGISTRY: us-east1-docker.pkg.dev
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Version from file
id: get-version
uses: juliangruber/read-file-action@v1
with:
path: ./.VERSION
- name: Login To Github Docker Registry
uses: docker/login-action@v1
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up build cache
uses: actions/cache@v2
with:
path: /tmp/.build-cache
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./deploy/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64, linux/arm64
push: true
cache-from: type=local,src=/tmp/.build-cache
cache-to: type=local,dest=/tmp/.build-cache
tags: |
${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get-version.outputs.content }}
labels: ${{ steps.meta.outputs.labels }}