Skip to content

Instantly share code, notes, and snippets.

@uurtech
Created March 20, 2020 10:57
Show Gist options
  • Save uurtech/0a21a759c382f8639c0cd3df32d7a823 to your computer and use it in GitHub Desktop.
Save uurtech/0a21a759c382f8639c0cd3df32d7a823 to your computer and use it in GitHub Desktop.
Golang Docker Multistage builder
FROM golang:latest
COPY main.go main.go
COPY controllers.go controllers.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
FROM scratch
MAINTAINER Uğur Kazdal girisiyorum@gmail.com
COPY --from=0 /go/main .
CMD ["./main"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment