xiabin c38090af5a
All checks were successful
/ start-services (push) Successful in 2s
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 40s
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Successful in 38s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Successful in 40s
/ build-services (app/user_service/Dockerfile, user, user) (push) Successful in 40s
update
2025-02-14 17:54:36 +08:00

33 lines
681 B
Docker

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
RUN apk add --no-cache git
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go env -w GOPRIVATE=gitea.youtukeji.com.cn
RUN go mod download
COPY . .
RUN go build -ldflags="-s -w" -o /app/auth ./app/auth_service/auth_service.go
FROM alpine
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
ENV TZ=Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/auth /app/auth
EXPOSE 8888
CMD ["/app/auth"]