Skip to content

Instantly share code, notes, and snippets.

@inductor
Created May 13, 2022 22:58
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 inductor/ca000a2437dce74b95ffc716bf0268ea to your computer and use it in GitHub Desktop.
Save inductor/ca000a2437dce74b95ffc716bf0268ea to your computer and use it in GitHub Desktop.
Dockerfile
# syntax=docker/dockerfile:1.4
FROM golang:1.17-bullseye as build
WORKDIR /go/src/app
RUN <<EOF
apt-get update
apt-get install -y git
apt-get clean \
rm -rf /var/lib/apt/lists/*
EOF
RUN --mount=type=ssh git clone git@github.com:myorg/myproject.git myproject
RUN go mod download
RUN go build -o /go/bin/app
# ビルドステージからコピー
FROM gcr.io/distroless/base-debian11
COPY --from=build /go/bin/app /
CMD ["/app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment