Created
July 19, 2021 19:47
-
-
Save starlightromero/0fd80e11ddcf89feaa1bc8a9331d813e to your computer and use it in GitHub Desktop.
Golang Dockerfile.scratch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:1.16-alpine as build | |
| RUN apk add ca-certificates=20191127-r5 --no-cache | |
| WORKDIR /app | |
| COPY go.mod . | |
| COPY go.sum . | |
| RUN go mod download | |
| COPY . . | |
| RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build . | |
| FROM scratch | |
| COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | |
| COPY --from=build /app/geolocation /usr/bin/geolocation | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=2 CMD curl -f http://localhost/ || exit 1 | |
| ENTRYPOINT ["/usr/bin/geolocation"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment