mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-05 17:00:24 +08:00
Feat: add Dockerfile
This commit is contained in:
26
server/Dockerfile
Normal file
26
server/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
FROM golang:1.19-alpine3.16 as builder
|
||||||
|
|
||||||
|
ENV GOPROXY https://goproxy.cn
|
||||||
|
WORKDIR /mayfly
|
||||||
|
COPY go.mod go.mod
|
||||||
|
COPY go.sum go.sum
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copy the go source for building server
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux \
|
||||||
|
go build -a \
|
||||||
|
-o mayfly-go main.go
|
||||||
|
|
||||||
|
FROM alpine:3.16
|
||||||
|
|
||||||
|
RUN apk add --no-cache ca-certificates bash expat
|
||||||
|
|
||||||
|
WORKDIR /mayfly
|
||||||
|
|
||||||
|
COPY --from=builder /mayfly/config.yml /mayfly/config.yml
|
||||||
|
COPY --from=builder /mayfly/mayfly-go /usr/local/bin/mayfly-go
|
||||||
|
|
||||||
|
CMD ["mayfly-go"]
|
||||||
Reference in New Issue
Block a user