File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 10
10
permissions :
11
11
packages : write
12
12
contents : read
13
-
13
+ strategy :
14
+ fail-fast : false
15
+ matrix :
16
+ app_image : [ '', 'ubuntu20.04', 'ubuntu22.04' ]
14
17
steps :
15
18
- uses : actions/checkout@v3
16
19
@@ -29,12 +32,16 @@ jobs:
29
32
run : |
30
33
VERSION=${GITHUB_REF/refs\/tags\//}
31
34
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
35
+ # if app_image == '' then '' else '-<app_image>'
36
+ IMAGE_TAG_SUFFIX=$([ ${{ matrix.app_image }} == '' ] && echo '' || echo -${{ matrix.app_image }})
37
+ echo "IMAGE_TAG_SUFFIX=${IMAGE_TAG_SUFFIX}" >> $GITHUB_OUTPUT
32
38
33
39
- name : Build and push
34
40
id : docker-build
35
41
uses : docker/build-push-action@v4
36
42
with :
37
43
push : true
38
- build-args :
39
- - VERSION=${{ steps.set-version.outputs.VERSION }}
40
- tags : ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.set-version.outputs.VERSION }}
44
+ build-args : |
45
+ VERSION=${{ steps.set-version.outputs.VERSION }}
46
+ APP_IMAGE=${{ matrix.app_image }}
47
+ tags : ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.set-version.outputs.VERSION }}${{ steps.set-version.outputs.IMAGE_TAG_SUFFIX }}
Original file line number Diff line number Diff line change
1
+ ARG APP_IMAGE=ubuntu:latest
2
+
1
3
# Build
2
4
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build
3
5
@@ -25,7 +27,7 @@ RUN go build -trimpath \
25
27
-o file.d ./cmd/file.d
26
28
27
29
# Deploy
28
- FROM ubuntu:20.04
30
+ FROM $APP_IMAGE
29
31
30
32
RUN apt update
31
33
RUN apt install systemd strace tcpdump traceroute telnet iotop curl jq iputils-ping htop -y
You can’t perform that action at this time.
0 commit comments