File tree Expand file tree Collapse file tree 5 files changed +52
-13
lines changed
Expand file tree Collapse file tree 5 files changed +52
-13
lines changed Original file line number Diff line number Diff line change 11name : Linter
22
33on :
4- push :
5- paths :
6- - " **/*.go"
7- - " .github/workflows/linter.yml"
84 pull_request :
95 types : [opened, synchronize, reopened]
106 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 5454 - name : Show workflow information
5555 run : |
5656 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
5858
5959 - name : Build
6060 uses : crazy-max/ghaction-xgo@v2
Original file line number Diff line number Diff line change 44/upload
55/.vscode
66sonic.db
7+ sonic
78__debug_bin
89/resources /template /theme /
910! /resources /template /theme /default-theme-anatole
Original file line number Diff line number Diff line change 11FROM golang:1.19.3-alpine as builder
2-
32RUN apk --no-cache add git ca-certificates gcc g++
43
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/
95WORKDIR /go/src/github.com/go-sonic/sonic
106
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 .
1214
1315RUN mkdir -p /app/conf && \
1416 mkdir /app/resources && \
@@ -17,12 +19,14 @@ RUN mkdir -p /app/conf && \
1719 cp -r /go/src/github.com/go-sonic/sonic/resources /app/ && \
1820 cp /go/src/github.com/go-sonic/sonic/scripts/docker_init.sh /app/
1921
22+
23+
24+
2025FROM alpine:latest as prod
2126
2227COPY --from=builder /app/ /app/
2328
24- RUN apk update \
25- && apk add --no-cache tzdata \
29+ RUN apk add --no-cache tzdata \
2630 && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
2731 && echo "Asia/Shanghai" > /etc/timezone
2832
You can’t perform that action at this time.
0 commit comments