This commit is contained in:
parent
c3d33aaf3f
commit
9a63355711
32
Dockerfile
32
Dockerfile
@ -1,8 +1,10 @@
|
||||
# Build stage
|
||||
FROM docker.io/library/golang:1.23-alpine3.20 AS build-env
|
||||
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-direct}
|
||||
ARG GOPROXY=https://proxy.golang.org,direct
|
||||
ENV GOPROXY=${GOPROXY}
|
||||
ENV GOPRIVATE=
|
||||
ENV GONOSUMDB=*
|
||||
|
||||
ARG GITEA_VERSION=deploy_custom
|
||||
ARG TAGS="sqlite sqlite_unlock_notify"
|
||||
@ -15,17 +17,31 @@ RUN apk --no-cache add \
|
||||
git \
|
||||
nodejs \
|
||||
npm \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
ca-certificates \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& update-ca-certificates
|
||||
|
||||
RUN npm --version
|
||||
# Устанавливаем таймауты для git и go
|
||||
RUN git config --global http.postBuffer 1048576000 \
|
||||
&& git config --global http.lowSpeedLimit 0 \
|
||||
&& git config --global http.lowSpeedTime 999999
|
||||
|
||||
# Setup repo
|
||||
# Setup repo - сначала копируем только необходимые файлы
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Копируем остальные файлы
|
||||
COPY . ${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 \
|
||||
&& make clean-all build
|
||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi
|
||||
|
||||
# Пробуем сборку с ретраями
|
||||
RUN for i in {1..3}; do \
|
||||
make clean-all build && break || \
|
||||
(echo "Attempt $i failed, retrying in 5 seconds..." && sleep 5); \
|
||||
done
|
||||
|
||||
# Begin env-to-ini build
|
||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||
@ -85,4 +101,4 @@ CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||
COPY --from=build-env /tmp/local /
|
||||
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
||||
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
|
||||
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
||||
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
||||
Loading…
Reference in New Issue
Block a user