mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-18 07:12:20 +00:00
f3dfb14321
Refs: https://codeberg.org/forgejo/website/pulls/230 (cherry picked from commit87d56bf6c7
) [CI] Forgejo Actions based release process (squash) base64 -w0 to avoid wrapping when the doer name is long as it creates a broken config.json (cherry picked from commit9efdc27e49
) [CI] Forgejo Actions based release process (squash) generate .xz files and sources Generate .xz files Check .sha256 Generate the source tarbal (cherry picked from commit7afec520c4
) [CI] Forgejo Actions based release process (squash) release notes (cherry picked from commitd8f4f4807b
) [CI] Forgejo Actions based release process (squash) publish and sign release (cherry picked from commita52778c747
) (cherry picked from commitcf2ec62740
) [CI] Forgejo Actions based release process (squash) version use Actions environment variables in Makefile (#25319) (#25318) uses Actions variable to determine the version. But Forgejo builds happen in a container where they are not available. Do not use them. Also verify the version of the binary is as expected for sanity check. (cherry picked from commit6decf111a1
) (cherry picked from commit206d0b3886
) [CI] read STORED_VERSION_FILE if available (cherry picked from commitaf74085ebf
) [CI] backward compatible executable compilation Add a new static-executable target to use in Dockerfiles and restore the $(EXECUTABLE) target to what it was before to for backward compatibility. The release process now builds static executables instead of dynamically linked ones which makes them more portable. It changes the requirements at compile time and is not backward compatible. In particular it may break packaging that rely on the target that currently creates a dynamically linked executable. (cherry picked from commit84d02a174a
) (cherry picked from commit854be47328
) [CI] Forgejo Actions based release process (squash) doc / ca / verbosity - Document workflow - Increase verbosity if VERBOSE=true - Download the Certificate Authority if behind the VPN (cherry picked from commit168d5d5869
) (cherry picked from commit8756c9a72a
) (cherry picked from commit2dad7ef20f
) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commit5531d01f19
) [CI] Forgejo Actions based release process (squash) add assets sources-tarbal bindata.go is a file, not a directory Refs: https://codeberg.org/forgejo/forgejo/issues/1115 (cherry picked from commitbd88a44778
) (cherry picked from commitb408085138
) [CI] Forgejo Actions based release process (squash) public/assets moved (cherry picked from commitd8c921d5a6
) (cherry picked from commit f29e50b1a09b1a22fc2dbdb77e9a1def1196175b) [CI] Fix release notes link - Use substitution to replace all dots with dashes. - Resolves https://codeberg.org/forgejo/forgejo/issues/1163 (cherry picked from commit 96783728f53a072915cace392aa269adfe9a5c73) (cherry picked from commitc8d8bf8996
) [CI] pin go v1.20 for testing Refs: https://codeberg.org/forgejo/forgejo/issues/1228 (cherry picked from commitfd4b5a013e
) (cherry picked from commit00bb15f57f
) Conflicts: Dockerfile Dockerfile.rootless see https://codeberg.org/forgejo/forgejo/pulls/1303 (cherry picked from commit6e2be54a6d
) (cherry picked from commit346c418b4a
) (cherry picked from commit49061f8422
) (cherry picked from commit8229d59b7e
) (cherry picked from commit70d45d9193
) [CI] Forgejo Actions based release process (squash) need node 18 (cherry picked from commit722b1f4590
) (cherry picked from commita91d786169
) [CI] Forgejo Actions based release process (squash) fix indentation (cherry picked from commitfbdf9d6abb
) (cherry picked from commit2deff90a13
) (cherry picked from commit5710a27fda
) [CI] Forgejo Actions based release process (squash) FQIN for docker Refs: https://codeberg.org/forgejo/forgejo/issues/1600 (cherry picked from commitf63d38deb6
) [CI] Forgejo Actions based release process (squash) use forgejo-curl.sh (cherry picked from commitc0c3ef506f
) (cherry picked from commit933ca7ec5d
) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/1691 (cherry picked from commit1068e48805
) [CI] Forgejo Actions based release process (squash) size optimization (cherry picked from commit3c653ff742
) (cherry picked from commit398567fc0c
) (cherry picked from commite585db9a97
) (cherry picked from commit17e91c96e3
) [CI] Forgejo Actions based release process (squash) gitea to forgejo (cherry picked from commit9c06a318b8
) (cherry picked from commit95859da3b4
) (cherry picked from commite3a5f6c1ed
) (cherry picked from commit7b9b259c75
) (cherry picked from commitc4a152c8dc
) (cherry picked from commitb00bf599ef
) (cherry picked from commita7836ee2ee
) (cherry picked from commit3ea7dcbd5b
) (cherry picked from commit454d705e83
) (cherry picked from commit35e06c3009
) (cherry picked from commit904468a38f
) (cherry picked from commit890e86815a
) (cherry picked from commitbf9f94c63d
) (cherry picked from commitd025d061d1
) (cherry picked from commit32f209a8e1
) (cherry picked from commit38ef6802fc
) (cherry picked from commit8a19bbd2a8
) (cherry picked from commitf352dee786
) (cherry picked from commitb53d9fc090
) (cherry picked from commit3dae21f4c8
) (cherry picked from commit8b59e016c7
) (cherry picked from commit6f54ea6a0e
) (cherry picked from commited8d90de6b
) (cherry picked from commit26ffd3fcac
) (cherry picked from commit287b3bbfb5
) (cherry picked from commitab81378d0c
) (cherry picked from commitf6bbe7e875
) (cherry picked from commit8968f34edf
) (cherry picked from commitd3d914bba2
) (cherry picked from commit4e4006a990
) (cherry picked from commitedb333569b
) (cherry picked from commit6c1a4baa15
) (cherry picked from commit51bda3bfc7
) (cherry picked from commit6f5f318b8f
) (cherry picked from commite128da2362
) (cherry picked from commit3e6735ff23
) (cherry picked from commit938c444125
) (cherry picked from commit67f92dc9ab
) (cherry picked from commitee31df71fb
) (cherry picked from commit386f232191
) (cherry picked from commit745785cd7f
) (cherry picked from commitefa8564e76
) Conflicts: Dockerfile Dockerfile.rootless https://codeberg.org/forgejo/forgejo/pulls/2029
102 lines
3 KiB
Docker
102 lines
3 KiB
Docker
FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
|
|
|
|
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.21-alpine3.19 as build-env
|
|
|
|
ARG GOPROXY
|
|
ENV GOPROXY ${GOPROXY:-direct}
|
|
|
|
ARG GITEA_VERSION
|
|
ARG TAGS="sqlite sqlite_unlock_notify"
|
|
ENV TAGS "bindata timetzdata $TAGS"
|
|
ARG CGO_EXTRA_CFLAGS
|
|
|
|
#
|
|
# Transparently cross compile for the target platform
|
|
#
|
|
COPY --from=xx / /
|
|
ARG TARGETPLATFORM
|
|
RUN apk --no-cache add clang lld
|
|
RUN xx-apk --no-cache add gcc musl-dev
|
|
ENV CGO_ENABLED=1
|
|
RUN xx-go --wrap
|
|
#
|
|
# for go generate and binfmt to find
|
|
# without it the generate phase will fail with
|
|
# #19 25.04 modules/public/public_bindata.go:8: running "go": exit status 1
|
|
# #19 25.39 aarch64-binfmt-P: Could not open '/lib/ld-musl-aarch64.so.1': No such file or directory
|
|
# why exactly is it needed? where is binfmt involved?
|
|
#
|
|
RUN cp /*-alpine-linux-musl*/lib/ld-musl-*.so.1 /lib || true
|
|
|
|
RUN apk --no-cache add build-base git nodejs npm
|
|
|
|
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
|
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
|
|
|
RUN make clean-all
|
|
RUN make frontend
|
|
RUN go build contrib/environment-to-ini/environment-to-ini.go && xx-verify environment-to-ini
|
|
RUN make go-check generate-backend static-executable && xx-verify gitea
|
|
|
|
# Copy local files
|
|
COPY docker/rootless /tmp/local
|
|
|
|
# Set permissions
|
|
RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
|
|
/tmp/local/usr/local/bin/docker-setup.sh \
|
|
/tmp/local/usr/local/bin/gitea \
|
|
/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.19
|
|
LABEL maintainer="contact@forgejo.org"
|
|
|
|
EXPOSE 2222 3000
|
|
|
|
RUN apk --no-cache add \
|
|
bash \
|
|
ca-certificates \
|
|
dumb-init \
|
|
gettext \
|
|
git \
|
|
curl \
|
|
gnupg \
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
RUN addgroup \
|
|
-S -g 1000 \
|
|
git && \
|
|
adduser \
|
|
-S -H -D \
|
|
-h /var/lib/gitea/git \
|
|
-s /bin/bash \
|
|
-u 1000 \
|
|
-G git \
|
|
git
|
|
|
|
RUN mkdir -p /var/lib/gitea /etc/gitea
|
|
RUN chown git:git /var/lib/gitea /etc/gitea
|
|
|
|
COPY --from=build-env /tmp/local /
|
|
RUN cd /usr/local/bin ; ln -s gitea forgejo
|
|
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
|
COPY --from=build-env --chown=root:root /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
|
|
|
|
#git:git
|
|
USER 1000:1000
|
|
ENV GITEA_WORK_DIR /var/lib/gitea
|
|
ENV GITEA_CUSTOM /var/lib/gitea/custom
|
|
ENV GITEA_TEMP /tmp/gitea
|
|
ENV TMPDIR /tmp/gitea
|
|
|
|
#TODO add to docs the ability to define the ini to load (useful to test and revert a config)
|
|
ENV GITEA_APP_INI /etc/gitea/app.ini
|
|
ENV HOME "/var/lib/gitea/git"
|
|
VOLUME ["/var/lib/gitea", "/etc/gitea"]
|
|
WORKDIR /var/lib/gitea
|
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
|
|
CMD []
|
|
|