Skip to content

Instantly share code, notes, and snippets.

@rspier
Created March 11, 2024 22:37
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 rspier/693f0a39f5ed2210a6b450a238328335 to your computer and use it in GitHub Desktop.
Save rspier/693f0a39f5ed2210a6b450a238328335 to your computer and use it in GitHub Desktop.
FROM golang:alpine as BUILDER
RUN apk update && apk add --no-cache git
WORKDIR /src
# << bake dependencies into builder image
COPY go.mod .
COPY go.sum .
RUN go mod download
# >>
# bring source into image
COPY . .
# build
RUN CGO_ENABLED=0 go build -o /go/bin/imap-pusher github.com/rspier/random/imap-pusher
RUN touch /.empty
FROM scratch
WORKDIR /
COPY --from=builder /go/bin/imap-pusher /imap-pusher
# If we don't put something in the /tmp/ directory, it doesn't exist,
# since this is FROM scratch.
COPY --from=builder /.empty /tmp/.empty
COPY --from=builder /etc/ssl /etc/ssl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment