Skip to content

Instantly share code, notes, and snippets.

@dirien
Created August 21, 2022 17:40
Show Gist options
  • Save dirien/1a5d260d8997f0afd1f68039d671eeac to your computer and use it in GitHub Desktop.
Save dirien/1a5d260d8997f0afd1f68039d671eeac to your computer and use it in GitHub Desktop.
Heredoc Golang Dockerfile
# 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