Created
August 21, 2022 17:40
-
-
Save dirien/1a5d260d8997f0afd1f68039d671eeac to your computer and use it in GitHub Desktop.
Heredoc Golang Dockerfile
This file contains 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
# syntax=docker/dockerfile:1.4.1 | |
FROM golang:1.19 AS build | |
COPY <<EOF main.go | |
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Hello Distroless-World") | |
} | |
EOF | |
RUN go build -o /demo main.go | |
FROM ghcr.io/distroless/static@sha256:baf53a1c76184d7e56541a5cdd3f03beea2b22f7112dd71f59dd0b557493290c | |
COPY --from=build /demo /usr/bin/demo | |
ENTRYPOINT ["/usr/bin/demo"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment