Skip to content

Instantly share code, notes, and snippets.

@kmckelvin
Last active February 11, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmckelvin/253bb83d1dde4d178b41693578ec03a5 to your computer and use it in GitHub Desktop.
Save kmckelvin/253bb83d1dde4d178b41693578ec03a5 to your computer and use it in GitHub Desktop.
Multiple base images when building
FROM golang:1.9.4 AS build
WORKDIR /go/src/github.com/kmckelvin/app
COPY . .
RUN go test ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /app main.go
FROM scratch
COPY --from=build /app /
ENV PORT 80
CMD ["/app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment