All checks were successful
Deploy Gitea Custom / build-and-deploy (push) Successful in 6m10s
104 lines
2.7 KiB
Docker
104 lines
2.7 KiB
Docker
# Build stage
|
||
FROM docker.io/library/golang:1.23-alpine3.20 AS build-env
|
||
|
||
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"
|
||
ENV TAGS="bindata timetzdata $TAGS"
|
||
ARG CGO_EXTRA_CFLAGS
|
||
|
||
# Build deps
|
||
RUN apk --no-cache add \
|
||
build-base \
|
||
git \
|
||
nodejs \
|
||
npm \
|
||
ca-certificates \
|
||
&& rm -rf /var/cache/apk/* \
|
||
&& update-ca-certificates
|
||
|
||
# Устанавливаем таймауты для git и go
|
||
RUN git config --global http.postBuffer 1048576000 \
|
||
&& git config --global http.lowSpeedLimit 0 \
|
||
&& git config --global http.lowSpeedTime 999999
|
||
|
||
# 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
|
||
|
||
# Пробуем сборку с ретраями
|
||
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
|
||
|
||
# Copy local files
|
||
COPY docker/root /tmp/local
|
||
|
||
# Set permissions
|
||
RUN chmod 755 /tmp/local/usr/bin/entrypoint \
|
||
/tmp/local/usr/local/bin/gitea \
|
||
/tmp/local/etc/s6/gitea/* \
|
||
/tmp/local/etc/s6/openssh/* \
|
||
/tmp/local/etc/s6/.s6-svscan/* \
|
||
/go/src/code.gitea.io/gitea/gitea \
|
||
/go/src/code.gitea.io/gitea/environment-to-ini
|
||
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
|
||
|
||
FROM docker.io/library/alpine:3.20
|
||
LABEL maintainer="maintainers@gitea.io"
|
||
|
||
EXPOSE 22 3000
|
||
|
||
RUN apk --no-cache add \
|
||
bash \
|
||
ca-certificates \
|
||
curl \
|
||
gettext \
|
||
git \
|
||
linux-pam \
|
||
openssh \
|
||
s6 \
|
||
sqlite \
|
||
su-exec \
|
||
gnupg \
|
||
&& rm -rf /var/cache/apk/*
|
||
|
||
RUN addgroup \
|
||
-S -g 1000 \
|
||
git && \
|
||
adduser \
|
||
-S -H -D \
|
||
-h /data/git \
|
||
-s /bin/bash \
|
||
-u 1000 \
|
||
-G git \
|
||
git && \
|
||
echo "git:*" | chpasswd -e
|
||
|
||
ENV USER=git
|
||
ENV GITEA_CUSTOM=/data/gitea
|
||
|
||
VOLUME ["/data"]
|
||
|
||
ENTRYPOINT ["/usr/bin/entrypoint"]
|
||
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 |