mirror of
https://github.com/mpolden/echoip.git
synced 2024-11-10 07:27:22 +01:00
Reduce image size
This commit is contained in:
parent
14f1a0ce88
commit
c623168acb
23
Dockerfile
23
Dockerfile
@ -1,15 +1,16 @@
|
||||
# Compile
|
||||
FROM golang:1.11-alpine AS build
|
||||
ADD . /go/src/github.com/mpolden/echoip
|
||||
# Build
|
||||
FROM golang:1.11-stretch AS build
|
||||
WORKDIR /go/src/github.com/mpolden/echoip
|
||||
RUN apk --update add git gcc musl-dev
|
||||
ENV GO111MODULE=on
|
||||
RUN go get -d -v .
|
||||
COPY . .
|
||||
ENV GO111MODULE=on CGO_ENABLED=0
|
||||
RUN go install ./...
|
||||
|
||||
# Run
|
||||
FROM alpine
|
||||
RUN mkdir -p /opt/
|
||||
COPY --from=build /go/bin/echoip /opt/
|
||||
WORKDIR /opt/
|
||||
ENTRYPOINT ["/opt/echoip"]
|
||||
FROM scratch
|
||||
EXPOSE 8080
|
||||
COPY --from=build \
|
||||
/go/bin/echoip \
|
||||
/go/src/github.com/mpolden/echoip/index.html \
|
||||
/opt/echoip/
|
||||
WORKDIR /opt/echoip
|
||||
ENTRYPOINT ["/opt/echoip/echoip"]
|
||||
|
Loading…
Reference in New Issue
Block a user