Add Gitea entrypoint to generate app.ini from template on startup
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6s

Since app.ini is gitignored, the container needs to create it at
runtime. The entrypoint copies the template on first start, then
Gitea's env var overrides handle secrets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 14:40:38 +01:00
parent cdcef5ba96
commit 7afd1be81b
2 changed files with 12 additions and 0 deletions

View File

@@ -152,6 +152,7 @@ services:
gitea: gitea:
image: docker.gitea.com/gitea:1.25.4-rootless image: docker.gitea.com/gitea:1.25.4-rootless
container_name: "${GITEA_HOST}" container_name: "${GITEA_HOST}"
entrypoint: ["/usr/bin/dumb-init", "--", "/etc/gitea/entrypoint.sh"]
networks: networks:
- app-network - app-network
environment: environment:
@@ -169,6 +170,7 @@ services:
volumes: volumes:
- ./gitea/data:/var/lib/gitea - ./gitea/data:/var/lib/gitea
- ./gitea/config:/etc/gitea - ./gitea/config:/etc/gitea
- ./gitea/entrypoint.sh:/etc/gitea/entrypoint.sh:ro
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
ports: ports:

10
gitea/entrypoint.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -e
# Generate app.ini from template if it doesn't already exist
if [ ! -f /etc/gitea/app.ini ]; then
cp /etc/gitea/app.ini.template /etc/gitea/app.ini
echo "Generated app.ini from template"
fi
exec /usr/local/bin/docker-entrypoint.sh "$@"