muyu-apiserver/deploy/Dockerfile.production

22 lines
818 B
Docker
Raw Normal View History

ARG BASE_REGISTRY=harbor-in-k3s.cheverjohn.me/library
FROM ${BASE_REGISTRY}/golang:1.24-alpine AS builder
ENV GOPROXY=https://goproxy.cn,direct
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
RUN apk add --no-cache git
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /server ./rpc/production/production.go
FROM ${BASE_REGISTRY}/alpine:3.20
RUN sed -i "s|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g" /etc/apk/repositories
RUN apk add --no-cache ca-certificates tzdata gettext
WORKDIR /app
COPY --from=builder /server ./production
COPY deploy/etc/production.yaml etc/production.yaml
COPY deploy/entrypoint.sh /entrypoint.sh
EXPOSE 9004
ENTRYPOINT ["/entrypoint.sh"]
CMD ["./production", "-f", "etc/production.yaml"]