forked from free-lancers/electricity_bill_calc_service
build(oci):加入容器化打包支持。
This commit is contained in:
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM golang:1.19-alpine AS builder
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY="https://goproxy.io"
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download && go mod verify
|
||||
ADD . /app
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -v -o server .
|
||||
|
||||
FROM alpine:latest AS production
|
||||
RUN mkdir /app
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/server .
|
||||
COPY settings.yaml .
|
||||
CMD ["./main"]
|
Reference in New Issue
Block a user