1+ # syntax=docker/dockerfile:1
12# Build stage
23FROM docker.io/library/golang:1.25-alpine3.22 AS build-env
34
@@ -16,46 +17,15 @@ RUN apk --no-cache add \
1617 pnpm
1718
1819WORKDIR ${GOPATH}/src/code.gitea.io/gitea
19-
20- COPY Makefile .
21-
22- # Fetch go dependencies
23- COPY go.mod go.sum ./
24- RUN --mount=type=cache,target=/go/pkg/mod \
25- go mod download
26-
27- # Fetch pnpm dependencies
28- COPY package.json pnpm-lock.yaml ./
29- RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
30- pnpm install --frozen-lockfile --prod
31-
32- COPY ./webpack.config.ts tailwind.config.ts ./
33- COPY ./assets ./assets
34- COPY ./public ./public
35- COPY ./web_src ./web_src
36-
37- RUN make frontend
38-
39- # Copy source files
40- COPY ./build ./build
41- COPY ./cmd ./cmd
42- COPY ./models ./models
43- COPY ./modules ./modules
44- COPY ./options ./options
45- COPY ./routers ./routers
46- COPY ./services ./services
47- COPY ./templates ./templates
48- COPY ./build.go .
49- COPY ./main.go .
50- COPY contrib/environment-to-ini/environment-to-ini.go contrib/environment-to-ini/environment-to-ini.go
51- COPY ./custom ./custom
20+ COPY --exclude=.git/ . .
5221
5322# Checkout version if set
5423RUN --mount=type=cache,target=/go/pkg/mod \
5524 --mount=type=cache,target="/root/.cache/go-build" \
56- --mount=type=bind,source=".git" ,target="${GOPATH}/src/code.gitea.io/gitea/.git" \
25+ --mount=type=cache,target=/root/.local/share/pnpm/store \
26+ --mount=type=bind,source=".git/" ,target=".git/" \
5727 if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}" ; fi \
58- && make backend
28+ && make
5929
6030# Begin env-to-ini build
6131RUN --mount=type=cache,target=/go/pkg/mod \
0 commit comments