23 lines
550 B
Docker
23 lines
550 B
Docker
# Modules Stage
|
|
FROM golang:1.24.4-alpine3.22 AS modules
|
|
ENV GO111MODULE=on \
|
|
GOPROXY=https://goproxy.cn,direct
|
|
COPY go.mod go.sum /modules/
|
|
WORKDIR /modules
|
|
RUN go mod download
|
|
|
|
# Build Stage
|
|
FROM golang:1.24.4-alpine3.22 AS builder
|
|
COPY --from=modules /go/pkg /go/pkg
|
|
WORKDIR /app
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o management main.go
|
|
|
|
# Run Stage
|
|
FROM zc1185230223/alpine:3.22
|
|
WORKDIR /app
|
|
COPY --from=builder /app/management .
|
|
RUN touch config.yaml
|
|
|
|
EXPOSE 15001
|
|
CMD ["/app/management", "erp", "-c", "config.yaml"] |