From e251e9e50b2e8d4de94a87abad087f73b406e9d8 Mon Sep 17 00:00:00 2001 From: forose <39984746+forose@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:20:16 +0800 Subject: [PATCH] Update Dockerfile (#39) Set up a proxy for Go --- Dockerfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c92048b..f3fca4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,22 @@ FROM golang:alpine AS builder WORKDIR /app +COPY . . -ADD . . +ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct +RUN go mod download -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o override +RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o override FROM alpine:latest -COPY --from=builder /app/override /usr/local/bin/override +RUN apk --no-cache add ca-certificates -WORKDIR /app +COPY --from=builder /app/override /usr/local/bin/ +COPY config.json.example /app/config.json -ENTRYPOINT ["/usr/local/bin/override"] +WORKDIR /app +VOLUME /app -EXPOSE 8181 +EXPOSE 8080 +CMD ["override"]