Files
admin-go/Dockerfile

25 lines
437 B
Docker
Raw Normal View History

2026-06-10 15:37:11 +08:00
# 阶段1: 构建
FROM golang:alpine AS builder
2026-06-08 16:43:58 +08:00
2026-06-10 15:37:11 +08:00
RUN apk add --no-cache git ca-certificates tzdata
2026-06-08 16:43:58 +08:00
2026-06-10 15:37:11 +08:00
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2026-06-08 16:43:58 +08:00
2026-06-10 15:37:11 +08:00
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
ENV CGO_ENABLED=0
ENV GOTOOLCHAIN=auto
WORKDIR /build
2026-03-18 10:19:42 +08:00
2026-06-10 15:37:11 +08:00
COPY . .
RUN go mod download && go mod tidy
RUN go build -ldflags="-s -w" -o main ./main.go
2026-03-18 10:19:42 +08:00
2026-04-22 14:13:28 +08:00
2026-04-22 13:57:38 +08:00
EXPOSE 8808
2026-03-18 10:19:42 +08:00
2026-03-18 10:40:33 +08:00
CMD ["./main"]