jamiemccrindle/dockerception

Not issue - A newer docker feature makes things easier

Opened this issue · 0 comments

This is a great repo which I planned to use for my project, but I found the below which could be simpler than this method.
https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
Using the multistage build of Docker, the docker file becomes simpler as below.
Dockerfile:

FROM golang:1.7.3
WORKDIR /go/src/github.com/alexellis/href-counter/
RUN go get -d -v golang.org/x/net/html  
COPY app.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

FROM alpine:latest  
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
CMD ["./app"]