mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-20 13:29:56 +01:00
Add mount cache for docker building
This commit is contained in:
parent
c5332fdc55
commit
062c5f45d0
17
Dockerfile
17
Dockerfile
@ -9,6 +9,12 @@ ARG TAGS="sqlite sqlite_unlock_notify"
|
||||
ENV TAGS="bindata timetzdata $TAGS"
|
||||
ARG CGO_EXTRA_CFLAGS
|
||||
|
||||
ARG GOCACHE
|
||||
ENV GOCACHE=${GOCACHE:-/root/.cache/go-build}
|
||||
|
||||
ARG GOMODCACHE
|
||||
ENV GOMODCACHE=${GOMODCACHE:-/go/pkg/mod}
|
||||
|
||||
# Build deps
|
||||
RUN apk --no-cache add \
|
||||
build-base \
|
||||
@ -24,10 +30,17 @@ WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||
|
||||
# Checkout version if set
|
||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||
&& make clean-all build
|
||||
&& make clean-all
|
||||
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
--mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=cache,target="/root/.cache/go-build" \
|
||||
make build
|
||||
|
||||
# Begin env-to-ini build
|
||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=cache,target="/root/.cache/go-build" \
|
||||
go build contrib/environment-to-ini/environment-to-ini.go
|
||||
|
||||
# Copy local files
|
||||
COPY docker/root /tmp/local
|
||||
|
||||
@ -9,6 +9,12 @@ ARG TAGS="sqlite sqlite_unlock_notify"
|
||||
ENV TAGS="bindata timetzdata $TAGS"
|
||||
ARG CGO_EXTRA_CFLAGS
|
||||
|
||||
ARG GOCACHE
|
||||
ENV GOCACHE=${GOCACHE:-/root/.cache/go-build}
|
||||
|
||||
ARG GOMODCACHE
|
||||
ENV GOMODCACHE=${GOMODCACHE:-/go/pkg/mod}
|
||||
|
||||
#Build deps
|
||||
RUN apk --no-cache add \
|
||||
build-base \
|
||||
@ -24,10 +30,17 @@ WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||
|
||||
# Checkout version if set
|
||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||
&& make clean-all build
|
||||
&& make clean-all
|
||||
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
--mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=cache,target="/root/.cache/go-build" \
|
||||
make build
|
||||
|
||||
# Begin env-to-ini build
|
||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=cache,target="/root/.cache/go-build" \
|
||||
go build contrib/environment-to-ini/environment-to-ini.go
|
||||
|
||||
# Copy local files
|
||||
COPY docker/rootless /tmp/local
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user