chore(Dockerfile.rootless): remove legacy config file support (#11098)

This legacy support was added in version 8. We now have version 14, so this deprecated feature can be confidently removed.

See dad16cd589 for a detailed explanation.

Docs PR: https://codeberg.org/forgejo/docs/pulls/1740

Co-authored-by: Jakob Linskeseder <jakob@linskeseder.com>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11098
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: jaylinski <jaylinski@noreply.codeberg.org>
Co-committed-by: jaylinski <jaylinski@noreply.codeberg.org>
This commit is contained in:
jaylinski 2026-03-02 06:03:39 +01:00 committed by 0ko
parent b921d5bdb3
commit cce5f868ce
4 changed files with 6 additions and 26 deletions

View file

@ -86,8 +86,8 @@ RUN addgroup \
-G git \ -G git \
git git
RUN mkdir -p /var/lib/gitea /etc/gitea RUN mkdir -p /var/lib/gitea
RUN chown git:git /var/lib/gitea /etc/gitea RUN chown git:git /var/lib/gitea
COPY --from=build-env /tmp/local / COPY --from=build-env /tmp/local /
RUN cd /usr/local/bin ; ln -s gitea forgejo RUN cd /usr/local/bin ; ln -s gitea forgejo
@ -103,13 +103,9 @@ ENV GITEA_CUSTOM=/var/lib/gitea/custom
ENV GITEA_TEMP=/tmp/gitea ENV GITEA_TEMP=/tmp/gitea
ENV TMPDIR=/tmp/gitea ENV TMPDIR=/tmp/gitea
# Legacy config file for backwards compatibility
# TODO: remove on next major version release
ENV GITEA_APP_INI_LEGACY=/etc/gitea/app.ini
ENV GITEA_APP_INI=${GITEA_CUSTOM}/conf/app.ini ENV GITEA_APP_INI=${GITEA_CUSTOM}/conf/app.ini
ENV HOME="/var/lib/gitea/git" ENV HOME="/var/lib/gitea/git"
VOLUME ["/var/lib/gitea", "/etc/gitea"] VOLUME ["/var/lib/gitea"]
WORKDIR /var/lib/gitea WORKDIR /var/lib/gitea
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]

View file

@ -13,10 +13,5 @@ fi
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
exec "$@" exec "$@"
else else
# TODO: remove on next major version release
# Honour legacy config file if existing
if [ -f ${GITEA_APP_INI_LEGACY} ]; then
GITEA_APP_INI=${GITEA_APP_INI_LEGACY}
fi
exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web
fi fi

View file

@ -11,22 +11,10 @@ mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM}
mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP} mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP}
if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi
# TODO: remove on next major version release # Prepare config file
# Honour legacy config file if existing, but inform the user
if [ -f ${GITEA_APP_INI_LEGACY} ] && [ ${GITEA_APP_INI} != ${GITEA_APP_INI_LEGACY} ]; then
GITEA_APP_INI_DEFAULT=/var/lib/gitea/custom/conf/app.ini
echo -e \
"\033[33mWARNING\033[0m: detected configuration file in deprecated default path ${GITEA_APP_INI_LEGACY}." \
"The new default is ${GITEA_APP_INI_DEFAULT}. To remove this warning, choose one of the options:\n" \
"* Move ${GITEA_APP_INI_LEGACY} to ${GITEA_APP_INI_DEFAULT} (or to \$GITEA_APP_INI if you want to override this variable)\n" \
"* Explicitly override GITEA_APP_INI=${GITEA_APP_INI_LEGACY} in the container environment"
GITEA_APP_INI=${GITEA_APP_INI_LEGACY}
fi
#Prepare config file
if [ ! -f ${GITEA_APP_INI} ]; then if [ ! -f ${GITEA_APP_INI} ]; then
#Prepare config file folder # Prepare config file folder
GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI}) GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI})
mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR} mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR}
if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi

1
release-notes/11098.md Normal file
View file

@ -0,0 +1 @@
In Forgejo v8.0.0, the default location for the config file was changed from `/etc/gitea/app.ini` to `/var/lib/gitea/app.ini`. Backward compatibility logic and startup warnings were added to container setup and entrypoint scripts. Now they are removed. This change only affects those using container deployments with rootless images. If you have the config file stored in a volume bound to container's /etc/gitea, move it to the new location or override the environment variable `GITEA_APP_INI`. An unused volume `/etc/gitea` can be safely removed from the container after moving the config or if the deployment never used versions prior to v8.0.0.