Docker Compose for Gitea
Gitea self-hosted Git service with PostgreSQL. Lightweight GitHub alternative.
gitea git postgres devops
compose.yaml
services:
gitea:
image: gitea/gitea:latest
ports:
- target: 3000
mode: ingress
- target: 22
mode: host
environment:
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=db:5432
- GITEA__database__NAME=gitea
- GITEA__database__USER=postgres
- GITEA__database__PASSWD=${GITEA__database__PASSWD}
healthcheck:
test:
- CMD
- curl
- -f
- http://localhost:3000/api/healthz
interval: 30s
timeout: 5s
retries: 3
depends_on:
- db
deploy:
resources:
reservations:
cpus: "0.5"
memory: 256M
restart: unless-stopped
db:
image: postgres:16
ports:
- target: 5432
mode: host
environment:
- POSTGRES_DB=gitea
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
reservations:
cpus: "0.5"
memory: 256M
restart: unless-stopped
x-defang-postgres: true
Services
- gitea gitea/gitea:latest
- db postgres:16