diff --git a/Dockerfile b/Dockerfile index 8b07ca5d..d3dd0e62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]