-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
3 changed files
with
14 additions
and
12 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 |
---|---|---|
|
@@ -3,11 +3,12 @@ FROM --platform=$TARGETPLATFORM golang:1.20-alpine AS builder | |
WORKDIR /app | ||
ARG TARGETARCH | ||
ENV GO111MODULE=on | ||
# ENV GOPROXY="https://goproxy.cn,direct" | ||
ENV GOPROXY="https://goproxy.cn,direct" | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -ldflags="-s -w" -o server . | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -ldflags="-s -w" -o server . && \ | ||
mv config/.env.example config/clash.ini dao/users.json server /app/static | ||
|
||
|
||
##打包镜像 | ||
|
@@ -17,13 +18,16 @@ LABEL org.opencontainers.image.authors="[email protected]" | |
LABEL org.opencontainers.image.description="用于管理翻墙系统用户和订阅" | ||
LABEL org.opencontainers.image.source="https://github.com/twbworld/proxy" | ||
WORKDIR /app | ||
COPY --from=builder /app/config/.env.example /app/config/clash.ini /app/config/ | ||
COPY --from=builder /app/dao/users.json /app/dao/ | ||
COPY --from=builder /app/static/ /app/static/ | ||
COPY --from=builder /app/server /app/ | ||
COPY --from=builder /app/static/ static/ | ||
RUN set -xe && \ | ||
chmod +x /app/server && \ | ||
mkdir -p dao config && \ | ||
mv static/.env.example config/.env && \ | ||
mv static/clash.ini config && \ | ||
mv static/users.json dao && \ | ||
mv static/server server && \ | ||
chmod +x server && \ | ||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
apk add -U --no-cache tzdata ca-certificates && \ | ||
rm -rf /var/cache/apk/* | ||
# EXPOSE 8080 | ||
CMD ["./server"] | ||
ENTRYPOINT ["./server"] |
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