tianyuan-api-server/apps/sentinel/Dockerfile

32 lines
786 B
Docker
Raw Permalink Normal View History

2024-10-02 00:57:17 +08:00
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
COPY apps/sentinel/etc /app/etc
2024-10-02 02:36:34 +08:00
RUN go build -ldflags="-s -w" -o /app/sentinel apps/sentinel/sentinel.go
2024-10-02 00:57:17 +08:00
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
ENV TZ Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/sentinel /app/sentinel
COPY --from=builder /app/etc /app/etc
CMD ["./sentinel", "-f", "etc/sentinel.yaml"]