This commit is contained in:
Pasha 2025-08-25 10:32:05 +03:00
parent fdeb29a298
commit ac11110db1

@ -1,4 +1,3 @@
# Build stage
FROM docker.io/library/golang:1.23-alpine3.20 AS build-env FROM docker.io/library/golang:1.23-alpine3.20 AS build-env
ARG GOPROXY=https://proxy.golang.org,direct ARG GOPROXY=https://proxy.golang.org,direct
@ -11,7 +10,6 @@ ARG TAGS="sqlite sqlite_unlock_notify"
ENV TAGS="bindata timetzdata $TAGS" ENV TAGS="bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS ARG CGO_EXTRA_CFLAGS
# Build deps
RUN apk --no-cache add \ RUN apk --no-cache add \
build-base \ build-base \
git \ git \
@ -21,35 +19,27 @@ RUN apk --no-cache add \
&& rm -rf /var/cache/apk/* \ && rm -rf /var/cache/apk/* \
&& update-ca-certificates && update-ca-certificates
# Устанавливаем таймауты для git и go
RUN git config --global http.postBuffer 1048576000 \ RUN git config --global http.postBuffer 1048576000 \
&& git config --global http.lowSpeedLimit 0 \ && git config --global http.lowSpeedLimit 0 \
&& git config --global http.lowSpeedTime 999999 && git config --global http.lowSpeedTime 999999
# Setup repo - сначала копируем только необходимые файлы
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
# Копируем остальные файлы
COPY . ${GOPATH}/src/code.gitea.io/gitea COPY . ${GOPATH}/src/code.gitea.io/gitea
WORKDIR ${GOPATH}/src/code.gitea.io/gitea WORKDIR ${GOPATH}/src/code.gitea.io/gitea
# Checkout version if set
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi
# Пробуем сборку с ретраями
RUN for i in {1..3}; do \ RUN for i in {1..3}; do \
make clean-all build && break || \ make clean-all build && break || \
(echo "Attempt $i failed, retrying in 5 seconds..." && sleep 5); \ (echo "Attempt $i failed, retrying in 5 seconds..." && sleep 5); \
done done
# Begin env-to-ini build
RUN go build contrib/environment-to-ini/environment-to-ini.go RUN go build contrib/environment-to-ini/environment-to-ini.go
# Copy local files
COPY docker/root /tmp/local COPY docker/root /tmp/local
# Set permissions
RUN chmod 755 /tmp/local/usr/bin/entrypoint \ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
/tmp/local/usr/local/bin/gitea \ /tmp/local/usr/local/bin/gitea \
/tmp/local/etc/s6/gitea/* \ /tmp/local/etc/s6/gitea/* \