-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.54 KB
/
Copy pathdocker-build.yml
File metadata and controls
52 lines (44 loc) · 1.54 KB
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
---
name: "build images"
on: [push, pull_request]
jobs:
docker-build:
strategy:
matrix:
UBUNTU_VER: [20.04, 22.04]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set REPO_NAME_LC
run: echo "REPO_NAME_LC=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set ON_MAIN_BRANCH
run: echo "ON_MAIN_BRANCH=$([ "$GITHUB_REF_NAME" == "main" ] && echo true || echo false)" >> $GITHUB_ENV # If it is from the main fork and is main branch
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
if: env.ON_MAIN_BRANCH == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
build-args: |
UBUNTU_VER=${{ matrix.UBUNTU_VER }}
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ env.ON_MAIN_BRANCH == 'true' }}
tags: ghcr.io/${{ env.REPO_NAME_LC }}:ubuntu${{ matrix.UBUNTU_VER }}