Update Dockerfile (#39)

Set up a proxy for Go
This commit is contained in:
forose 2024-06-19 12:20:16 +08:00 committed by GitHub
parent f93a0ed85f
commit e251e9e50b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 6 deletions

View File

@ -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
COPY --from=builder /app/override /usr/local/bin/
COPY config.json.example /app/config.json
WORKDIR /app
VOLUME /app
ENTRYPOINT ["/usr/local/bin/override"]
EXPOSE 8181
EXPOSE 8080
CMD ["override"]