Skip to content

Not issue - A newer docker feature makes things easier #4

@bssankaran

Description

@bssankaran

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"] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions