-
Notifications
You must be signed in to change notification settings - Fork 62
66 lines (59 loc) · 1.79 KB
/
docker-build.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
name: Create Docker Images
on:
push:
branches: [ master ]
jobs:
build:
env:
NODE_LATEST: 16
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 14, 16, 18 ]
suffix: [ "" ]
steps:
- name: 1-checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 2-setup-image-setting
id: setting
run: |
SUFFIX=""
if [ "${{ matrix.suffix }}" != "" ]; then
SUFFIX="-${{ matrix.suffix}}"
fi
TAGS="ghcr.io/${{ github.repository }}:${{ matrix.node }}$SUFFIX"
if [ "${{ matrix.node }}" == "${{ env.NODE_LATEST }}" ]; then
TAGS="$TAGS,ghcr.io/${{ github.repository }}:latest$SUFFIX"
fi
echo "current tags $TAGS"
echo "TAGS=$TAGS" >> $GITHUB_ENV
- name: 3-setup-tags-toLowerCase
uses: actions/github-script@v6
id: tags-tolowercase
with:
script: return `${process.env.TAGS.toLowerCase()}`
result-encoding: string
- name: 4-setup-qemu-action
uses: docker/setup-qemu-action@v2
- name: 5-login-action
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 6-setup-buildx-action
uses: docker/setup-buildx-action@v2
- name: 7-build-push-action
uses: docker/build-push-action@v3
continue-on-error: true
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6
push: true
build-args: |
NODE_VERSION=${{ matrix.node }}
tags: |
${{ steps.tags-tolowercase.outputs.result }}