-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5183bb5
commit 8ac33a0
Showing
4 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,16 +9,16 @@ on: | |
|
||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
# set environment | ||
- name: Set BUILD_TIME env | ||
run: echo "BUILD_TIME=$(date)" >> $GITHUB_ENV | ||
|
||
- name: Set COMMIT env | ||
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
- name: Set GIT_COMMIT env | ||
run: echo "GIT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
|
||
- name: Environment printer | ||
uses: managedkaos/[email protected] | ||
|
@@ -88,11 +88,11 @@ jobs: | |
with: | ||
push: true | ||
context: . | ||
platforms: linux/amd64,linux/arm/v7 | ||
platforms: linux/amd64,linux/arm/v7,linux/arm64 | ||
tags: ${{ steps.image-tags.outputs.container_images }} | ||
build-args: | | ||
APP_VERSION=${{ env.APP_VERSION }} | ||
BUILD_TIME=${{ env.BUILD_TIME }} | ||
COMMIT=${{ env.SHORT_SHA }} | ||
GIT_COMMIT=${{ env.GIT_COMMIT }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# Build stage | ||
FROM golang:1.17-alpine3.16 as builder | ||
LABEL maintainer="Khanh Ngo <[email protected]" | ||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine3.16 as builder | ||
LABEL maintainer="Khanh Ngo <[email protected]>" | ||
|
||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
ARG BUILDPLATFORM | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG APP_VERSION=dev | ||
ARG BUILD_TIME="" | ||
ARG COMMIT="" | ||
ARG BUILD_TIME | ||
ARG GIT_COMMIT | ||
|
||
ARG BUILD_DEPENDENCIES="npm \ | ||
yarn" | ||
|
@@ -52,7 +53,7 @@ COPY . /build | |
RUN cp -r /build/custom/ assets/ | ||
|
||
# Build | ||
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 . | ||
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 . | ||
|
||
# Release stage | ||
FROM alpine:3.16 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters