-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
1 changed file
with
26 additions
and
13 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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
# Multi stage build | ||
FROM golang:1.17 as builder | ||
ENV GO111MODULE=off | ||
#RUN go get -d github.com/getevo/evo | ||
|
||
WORKDIR /build | ||
# syntax=docker/dockerfile:1.2 | ||
FROM golang:1.19-bullseye as builder | ||
ENV DOCKER_BUILDKIT=1 | ||
# | ||
WORKDIR /app | ||
COPY go.mod ./ | ||
COPY . . | ||
RUN go get -d ./... | ||
RUN go build -o main . | ||
|
||
# Only runtime | ||
FROM golang:1.17 | ||
COPY --from=builder /build/main /build/main | ||
# | ||
#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 ./evo . | ||
# | ||
# | ||
#FROM phusion/baseimage:focal-1.2.0 | ||
# | ||
#COPY --from=builder /app /app | ||
#COPY --from=builder /app/cms / | ||
#WORKDIR /app | ||
# | ||
EXPOSE 8080 | ||
CMD ["/build/main","-c","/build/config.yml"] | ||
# | ||
CMD ["/build/evo", "-c","/build/config.yml"] |