-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eda2b04
commit 5ef0f3b
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# syntax=docker/dockerfile:1.2 | ||
FROM golang:1.19-bullseye as builder | ||
LABEL maintainer="[email protected]" | ||
ENV DOCKER_BUILDKIT=1 | ||
# | ||
WORKDIR /app | ||
COPY go.mod ./ | ||
COPY main.go ./ | ||
# | ||
#COPY go.sum ./ | ||
#RUN go mod tidy | ||
#RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get | ||
RUN --mount=type=cache,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build go mod tidy | ||
#ARG VERSION | ||
RUN --mount=type=cache,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
CGO_ENABLED=0 go build -installsuffix cgo -ldflags "-X main.version=1" -o ./scaffold . | ||
# | ||
# | ||
FROM phusion/baseimage:focal-1.2.0 | ||
# | ||
COPY --from=builder /app /app | ||
WORKDIR /app | ||
# | ||
CMD [ "./scaffold" ] | ||
# |