Update Dockerfile
This commit is contained in:
parent
062f69da2b
commit
2117b6321c
27
Dockerfile
27
Dockerfile
@ -1,28 +1,13 @@
|
|||||||
FROM golang:1-alpine as builder
|
FROM golang:alpine as builder
|
||||||
|
|
||||||
# RUN apk --no-cache --no-progress add git ca-certificates tzdata make \
|
|
||||||
# && update-ca-certificates \
|
|
||||||
# && rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
WORKDIR /go/whoami
|
|
||||||
|
|
||||||
# Download go modules
|
|
||||||
COPY go.mod .
|
|
||||||
COPY go.sum .
|
|
||||||
|
|
||||||
RUN go env -w GOPROXY=https://goproxy.cn,direct
|
|
||||||
# RUN GO111MODULE=on GOPROXY=https://proxy.golang.org go mod download
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build
|
RUN go env -w GOPROXY=https://goproxy.cn,direct
|
||||||
|
RUN go mod tidy
|
||||||
|
RUN go build -o whoami
|
||||||
|
|
||||||
# Create a minimal container to run a Golang static binary
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
COPY --from=builder /app/whoami .
|
||||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
||||||
COPY --from=builder /go/whoami/whoami .
|
|
||||||
|
|
||||||
ENTRYPOINT ["/whoami"]
|
ENTRYPOINT ["/whoami"]
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user