forked from beck-8/subs-check
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (28 loc) · 1005 Bytes
/
Dockerfile
File metadata and controls
29 lines (28 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM golang:alpine AS builder
WORKDIR /app
COPY . .
ARG GITHUB_SHA
ARG VERSION
RUN apk add --no-cache nodejs zstd && \
ARCH=$(uname -m) && \
case "$ARCH" in \
"x86_64") zstd -f /usr/bin/node -o assets/node_linux_amd64.zst ;; \
"aarch64") zstd -f /usr/bin/node -o assets/node_linux_arm64.zst ;; \
"armv7l") zstd -f /usr/bin/node -o assets/node_linux_armv7.zst ;; \
*) echo "不支持的架构: $ARCH" && exit 1 ;; \
esac
RUN echo "Building commit: ${GITHUB_SHA:0:7}" && \
go mod tidy && \
go build -ldflags="-s -w -X main.Version=${VERSION} -X main.CurrentCommit=${GITHUB_SHA:0:7}" -trimpath -o subs-check .
FROM alpine
WORKDIR /app
ENV TZ=Asia/Shanghai
RUN apk add --no-cache alpine-conf ca-certificates nodejs &&\
/usr/sbin/setup-timezone -z Asia/Shanghai && \
apk del alpine-conf && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/bin/node
COPY --from=builder /app/subs-check /app/subs-check
CMD ["/app/subs-check"]
EXPOSE 8199
EXPOSE 8299