-
-
Notifications
You must be signed in to change notification settings - Fork 95
96 lines (86 loc) · 3.27 KB
/
build_docker_image.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: MultiArchDockerBuild
on:
push:
branches:
- master
- develop
jobs:
build_multi_arch_image:
name: Build multi-arch Docker image.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set environment variables
run: echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push master (Alpine)
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v5
with:
provenance: false # enable later when runtime support is better
target: deploy
push: true
tags: |
charlocharlie/epicgames-freegames:latest
charlocharlie/epicgames-freegames:${{ github.sha }}
ghcr.io/claabs/epicgames-freegames-node:latest
ghcr.io/claabs/epicgames-freegames-node:${{ github.sha }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
COMMIT_SHA=${{ github.sha }}
BRANCH=${{ env.GIT_BRANCH }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
- name: Build and push master (Debian)
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v5
with:
provenance: false # enable later when runtime support is better
target: deploy
push: true
file: Dockerfile.debian
tags: |
charlocharlie/epicgames-freegames:bullseye-slim
ghcr.io/claabs/epicgames-freegames-node:bullseye-slim
charlocharlie/epicgames-freegames:debian
ghcr.io/claabs/epicgames-freegames-node:debian
platforms: linux/amd64
build-args: |
COMMIT_SHA=${{ github.sha }}
BRANCH=${{ env.GIT_BRANCH }}
cache-from: type=gha,scope=${{ github.workflow }}-Debian
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-Debian
- name: Build and push dev
if: ${{ github.ref == 'refs/heads/develop' }}
uses: docker/build-push-action@v5
with:
provenance: false # enable later when runtime support is better
target: deploy
push: true
tags: |
charlocharlie/epicgames-freegames:dev
ghcr.io/claabs/epicgames-freegames-node:dev
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
COMMIT_SHA=${{ github.sha }}
BRANCH=${{ env.GIT_BRANCH }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}