Fix module cache in staging.Dockerfile

This commit is contained in:
Bohdan Horbeshko 2024-04-09 19:09:47 -04:00
parent 3e772be7a6
commit 144c5724ea

View file

@ -23,15 +23,18 @@ FROM base AS cache
ARG VERSION ARG VERSION
COPY --from=tdlib /compiled/ /usr/local/ COPY --from=tdlib /compiled/ /usr/local/
WORKDIR /src WORKDIR /src
RUN --mount=type=cache,target=/go \ RUN go env -w GOCACHE=/go-cache
--mount=type=cache,target=/root/.cache/go-build \ RUN go env -w GOMODCACHE=/gomod-cache
RUN --mount=type=cache,target=/gomod-cache \
--mount=type=bind,source=./,target=/src \ --mount=type=bind,source=./,target=/src \
go get go mod download
FROM cache AS build FROM cache AS build
ARG MAKEOPTS ARG MAKEOPTS
WORKDIR /src WORKDIR /src
RUN --mount=type=bind,source=./,target=/src,rw \ RUN --mount=type=bind,source=./,target=/src,rw \
--mount=type=cache,target=/go-cache \
--mount=type=cache,target=/gomod-cache \
--mount=type=cache,destination=/src/release \ --mount=type=cache,destination=/src/release \
make ${MAKEOPTS} make ${MAKEOPTS}