-
Notifications
You must be signed in to change notification settings - Fork 28
59 lines (51 loc) · 1.66 KB
/
image-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
50
51
52
53
54
55
56
57
58
name: Build And Push
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
push-multiarch:
permissions:
contents: read
id-token: write
name: Build and Push amd64 and arm64
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Registry Login
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Set the GOLANG_VERSION value
id: get-GOLANG_VERSION
run: |
echo "GO_VERSION=$(make go-version)" >> "$GITHUB_ENV"
- name: Build Container Image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
"GOLANG_VERSION=${{ env.GO_VERSION }}"
tags: ${{ env.REPOSITORY_OWNER }}/hardened-build-base:${{ env.TAG }}
file: Dockerfile
platforms: linux/amd64,linux/arm64