File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
Expand file tree Collapse file tree 3 files changed +46
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 1+ FROM golang:alpine AS builder
2+ WORKDIR /app
3+
4+ RUN apk add --no-cache git bash
5+
6+ COPY go.mod go.sum ./
7+ RUN go mod download
8+
9+ COPY . .
10+
11+ ARG BUILT_AT
12+ ARG GIT_COMMIT
13+ ARG VERSION
14+
15+ RUN builtAt=${BUILT_AT:-$(date +'%F %T %z' )} && \
16+ gitCommit=${GIT_COMMIT:-$(git log --pretty=format:"%h" -1)} && \
17+ version=${VERSION:-$(git describe --abbrev=0 --tags)} && \
18+ ldflags="\
19+ -w -s \
20+ -X 'github.com/krau/ManyACG/common.BuildTime=$builtAt' \
21+ -X 'github.com/krau/ManyACG/common.Commit=$gitCommit' \
22+ -X 'github.com/krau/ManyACG/common.Version=$version'\
23+ " && \
24+ CGO_ENABLED=0 go build -ldflags "$ldflags" -o manyacg
25+
26+ FROM alpine:latest
27+ WORKDIR /opt/manyacg/
28+
29+ RUN apk add --no-cache bash ca-certificates ffmpeg && update-ca-certificates
30+
31+ COPY --from=builder /app/manyacg .
32+
33+ EXPOSE 39080
34+ ENTRYPOINT ["./manyacg" ]
Original file line number Diff line number Diff line change 1+ builtAt=" $( date +' %F %T %z' ) "
2+ gitCommit=$( git log --pretty=format:" %h" -1)
3+ version=$( git describe --abbrev=0 --tags)
4+
5+ ldflags=" \
6+ -w -s \
7+ -X 'github.com/krau/ManyACG/common.BuildTime=$builtAt ' \
8+ -X 'github.com/krau/ManyACG/common.Commit=$gitCommit ' \
9+ -X 'github.com/krau/ManyACG/common.Version=$version '\
10+ "
11+
12+ CGO_ENABLED=0 go build -ldflags " $ldflags " -o manyacg
You can’t perform that action at this time.
0 commit comments