File tree 5 files changed +52
-13
lines changed
5 files changed +52
-13
lines changed Original file line number Diff line number Diff line change 1
1
name : Linter
2
2
3
3
on :
4
- push :
5
- paths :
6
- - " **/*.go"
7
- - " .github/workflows/linter.yml"
8
4
pull_request :
9
5
types : [opened, synchronize, reopened]
10
6
paths :
Original file line number Diff line number Diff line change
1
+ name : Release-Docker
2
+
3
+ on :
4
+ release :
5
+ types : [published]
6
+
7
+ jobs :
8
+ docker :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ -
12
+ name : Set up QEMU
13
+ uses : docker/setup-qemu-action@v2
14
+ -
15
+ name : Set up Docker Buildx
16
+ uses : docker/setup-buildx-action@v2
17
+ -
18
+ name : Login to Docker Hub
19
+ uses : docker/login-action@v2
20
+ with :
21
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
22
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
23
+ -
24
+ name : Set build time
25
+ run : |
26
+ echo "BUILD_TIME=$(date +%FT%T%z)" >> $GITHUB_ENV
27
+ -
28
+ name : Build and push
29
+ uses : docker/build-push-action@v4
30
+ with :
31
+ platforms : linux/arm64,linux/amd64
32
+ push : true
33
+ file : ./scripts/Dockerfile
34
+ tags : gosonic/sonic:test
35
+ build-args : |
36
+ SONIC_VERSION=${{github.ref_name}}
37
+ BUILD_COMMIT=${{github.sha}}
38
+ BUILD_TIME=${{env.BUILD_TIME}}
Original file line number Diff line number Diff line change 54
54
- name : Show workflow information
55
55
run : |
56
56
echo "GOOS: $GOOS, GOARCH: $GOARCH"
57
- echo "BUILD_TIME=$(date --rfc-3339=seconds )" >> $GITHUB_ENV
57
+ echo "BUILD_TIME=$(date +%FT%T%z )" >> $GITHUB_ENV
58
58
59
59
- name : Build
60
60
uses : crazy-max/ghaction-xgo@v2
Original file line number Diff line number Diff line change 4
4
/upload
5
5
/.vscode
6
6
sonic.db
7
+ sonic
7
8
__debug_bin
8
9
/resources /template /theme /
9
10
! /resources /template /theme /default-theme-anatole
Original file line number Diff line number Diff line change 1
1
FROM golang:1.19.3-alpine as builder
2
-
3
2
RUN apk --no-cache add git ca-certificates gcc g++
4
3
5
- WORKDIR /go/src/github.com/go-sonic/
6
-
7
- RUN git clone --recursive --depth 1 https://github.com/go-sonic/sonic.git
8
-
4
+ COPY . /go/src/github.com/go-sonic/sonic/
9
5
WORKDIR /go/src/github.com/go-sonic/sonic
10
6
11
- RUN GOPROXY=https://goproxy.cn CGO_ENABLED=1 GOOS=linux go build -o sonic -ldflags="-s -w" -trimpath .
7
+ ARG BUILD_COMMIT
8
+ ARG BUILD_TIME
9
+ ARG SONIC_VERSION
10
+
11
+
12
+ RUN CGO_ENABLED=1 GOOS=linux && \
13
+ go build -o sonic -ldflags="-s -w -X github.com/go-sonic/sonic/consts.SonicVersion=${SONIC_VERSION} -X github.com/go-sonic/sonic/consts.BuildCommit=${BUILD_COMMIT} -X github.com/go-sonic/sonic/consts.BuildTime=${BUILD_TIME}" -trimpath .
12
14
13
15
RUN mkdir -p /app/conf && \
14
16
mkdir /app/resources && \
@@ -17,12 +19,14 @@ RUN mkdir -p /app/conf && \
17
19
cp -r /go/src/github.com/go-sonic/sonic/resources /app/ && \
18
20
cp /go/src/github.com/go-sonic/sonic/scripts/docker_init.sh /app/
19
21
22
+
23
+
24
+
20
25
FROM alpine:latest as prod
21
26
22
27
COPY --from=builder /app/ /app/
23
28
24
- RUN apk update \
25
- && apk add --no-cache tzdata \
29
+ RUN apk add --no-cache tzdata \
26
30
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
27
31
&& echo "Asia/Shanghai" > /etc/timezone
28
32
You can’t perform that action at this time.
0 commit comments