Skip to content

Commit 8ac33a0

Browse files
committed
GHA fixes
1 parent 5183bb5 commit 8ac33a0

4 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ on:
99

1010
jobs:
1111
build-image:
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
# set environment
1717
- name: Set BUILD_TIME env
1818
run: echo "BUILD_TIME=$(date)" >> $GITHUB_ENV
1919

20-
- name: Set COMMIT env
21-
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
20+
- name: Set GIT_COMMIT env
21+
run: echo "GIT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
2222

2323
- name: Environment printer
2424
uses: managedkaos/print-env@v1.0
@@ -88,11 +88,11 @@ jobs:
8888
with:
8989
push: true
9090
context: .
91-
platforms: linux/amd64,linux/arm/v7
91+
platforms: linux/amd64,linux/arm/v7,linux/arm64
9292
tags: ${{ steps.image-tags.outputs.container_images }}
9393
build-args: |
9494
APP_VERSION=${{ env.APP_VERSION }}
9595
BUILD_TIME=${{ env.BUILD_TIME }}
96-
COMMIT=${{ env.SHORT_SHA }}
96+
GIT_COMMIT=${{ env.GIT_COMMIT }}
9797
cache-from: type=gha
9898
cache-to: type=gha,mode=max

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
releases-matrix:
99
name: Release Go Binary
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
strategy:
1212
matrix:
1313
# build and publish in parallel: linux/386, linux/amd64, darwin/386, darwin/amd64
@@ -24,7 +24,7 @@ jobs:
2424
- 7
2525
steps:
2626
# get the source code
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v3
2828

2929
# set environment
3030
- name: Set APP_VERSION env

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Build stage
2-
FROM golang:1.17-alpine3.16 as builder
3-
LABEL maintainer="Khanh Ngo <k@ndk.name"
2+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine3.16 as builder
3+
LABEL maintainer="Khanh Ngo <k@ndk.name>"
44

5-
ARG TARGETOS=linux
6-
ARG TARGETARCH=amd64
5+
ARG BUILDPLATFORM
6+
ARG TARGETOS
7+
ARG TARGETARCH
78
ARG APP_VERSION=dev
8-
ARG BUILD_TIME=""
9-
ARG COMMIT=""
9+
ARG BUILD_TIME
10+
ARG GIT_COMMIT
1011

1112
ARG BUILD_DEPENDENCIES="npm \
1213
yarn"
@@ -52,7 +53,7 @@ COPY . /build
5253
RUN cp -r /build/custom/ assets/
5354

5455
# Build
55-
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.appVersion=${APP_VERSION}' -X 'main.buildTime=${BUILD_TIME}' -X 'main.gitCommit=${COMMIT}'" -a -o wg-ui .
56+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.appVersion=${APP_VERSION}' -X 'main.buildTime=${BUILD_TIME}' -X 'main.gitCommit=${GIT_COMMIT}'" -a -o wg-ui .
5657

5758
# Release stage
5859
FROM alpine:3.16

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ feature work.
195195
Go to the project root directory and run the following command:
196196

197197
```sh
198-
docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) -t wireguard-ui .
198+
docker build --build-arg=GIT_COMMIT=$(git rev-parse --short HEAD) -t wireguard-ui .
199199
```
200200

201201
or
202202

203203
```sh
204-
docker compose build --build-arg=COMMIT=$(git rev-parse --short HEAD)
204+
docker compose build --build-arg=GIT_COMMIT=$(git rev-parse --short HEAD)
205205
```
206206

207207
:information_source: A container image is avaialble on [Docker Hub](https://hub.docker.com/r/ngoduykhanh/wireguard-ui) which you can pull and use

0 commit comments

Comments
 (0)