-
Notifications
You must be signed in to change notification settings - Fork 6
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
c222001
commit 6c71023
Showing
19 changed files
with
484 additions
and
654 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 |
---|---|---|
@@ -1,15 +1,37 @@ | ||
FROM registry.cn-hangzhou.aliyuncs.com/fmm-ink/golang:1.19.9 AS builder | ||
FROM golang:1.22.5 AS builder | ||
WORKDIR /build | ||
COPY . /build | ||
|
||
RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.cn,direct && go env -w GOSUMDB=off && go mod tidy | ||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w -extldflags '-static'" -o main main.go | ||
# 设置编译环境变量 | ||
# GODEBUG=tlsrsakex=1。By default, cipher suites without ECDHE support are no longer offered by either clients or servers during pre-TLS 1.3 handshakes. This change can be reverted with the tlsrsakex=1 GODEBUG setting. | ||
# https://go.dev/doc/go1.22 | ||
ENV GO111MODULE=on \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 \ | ||
GOPROXY=https://goproxy.cn,direct \ | ||
GOPRIVATE=gomod.sunmi.com \ | ||
GOSUMDB=off \ | ||
GODEBUG=tlsrsakex=1 | ||
|
||
FROM registry.cn-hangzhou.aliyuncs.com/fmm-ink/alpine:3.18 | ||
# 将 go.mod 复制到容器中 | ||
COPY go.mod ./ | ||
|
||
# 下载依赖模块,并使用缓存 | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
go mod download | ||
|
||
# 把当前目录的所有内容copy到 WORKDIR指定的目录中 | ||
COPY . . | ||
|
||
# Go编译,并使用缓存 | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
go build -o main main.go && strip main | ||
|
||
FROM alpine:3.19.1 | ||
WORKDIR /app | ||
|
||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && apk add --no-cache curl net-tools busybox-extras iproute2 | ||
COPY --from=builder /build/main /usr/bin/main | ||
COPY --from=builder /build/app/cfg/config.yaml /app/cfg/config.yaml | ||
COPY --from=builder /build/app/conf/config.yaml /app/conf/config.yaml | ||
|
||
CMD ["main", "-conf", "/app/cfg/config.yaml"] | ||
CMD ["main", "-conf", "/app/conf/config.yaml"] |
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
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
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
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
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
Oops, something went wrong.