Update Dockerfile
parent
61a6138b89
commit
7bce772491
24
Dockerfile
24
Dockerfile
|
@ -1,16 +1,32 @@
|
||||||
FROM golang:1.10-alpine as go
|
FROM golang:1.10-alpine as build
|
||||||
|
|
||||||
WORKDIR /go/src/hello-world
|
# args
|
||||||
|
ARG version="1.0.0"
|
||||||
|
ARG repo="github.com/productionwentdown/hello-world"
|
||||||
|
|
||||||
|
# source
|
||||||
|
WORKDIR $GOPATH/src/${repo}
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# build
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ENV GOOS=linux
|
ENV GOOS=linux
|
||||||
ENV GOARCH=amd64
|
ENV GOARCH=amd64
|
||||||
RUN go build -ldflags '-extldflags "-static"' -o hello-world
|
RUN go build -ldflags "-s -w" -o /hello-world
|
||||||
|
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
|
ARG version
|
||||||
|
|
||||||
|
# labels
|
||||||
|
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/hello-world"
|
||||||
|
LABEL org.label-schema.version=${version}
|
||||||
|
LABEL org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
# copy binary
|
||||||
|
COPY --from=build /hello-world /hello-world
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
COPY --from=go /go/src/hello-world/hello-world hello-world
|
|
||||||
|
|
||||||
ENTRYPOINT ["/hello-world"]
|
ENTRYPOINT ["/hello-world"]
|
||||||
|
|
Loading…
Reference in New Issue