64 lines
2.1 KiB
YAML
64 lines
2.1 KiB
YAML
# Gitea Git Service with PostgreSQL Database Configuration
|
|
services:
|
|
# PostgreSQL Database Service
|
|
gitea_db:
|
|
# Basic container configuration
|
|
container_name: gitea_db
|
|
image: docker.io/library/postgres:17.5
|
|
restart: unless-stopped
|
|
|
|
# Database credentials and configuration
|
|
environment:
|
|
- POSTGRES_USER=${POSTGRES_USER} # Database admin username
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} # Database admin password
|
|
- POSTGRES_DB=${POSTGRES_DB} # Database name for Gitea
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/gitea/db:/var/lib/postgresql/data
|
|
|
|
# Network port configuration
|
|
ports:
|
|
- ${DB_PORT}:5432 # Maps host port to PostgreSQL
|
|
|
|
# Health check configuration
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
|
|
start_period: 10s # Initial delay before checks
|
|
interval: 10s # Check interval
|
|
timeout: 5s # Check timeout
|
|
retries: 3 # Allowed retries
|
|
|
|
# Gitea Server Service
|
|
gitea_server:
|
|
# Basic container configuration
|
|
container_name: gitea_server
|
|
image: docker.io/gitea/gitea:1.24.3-rootless
|
|
restart: unless-stopped
|
|
|
|
# Service dependencies
|
|
depends_on:
|
|
gitea_db:
|
|
condition: service_healthy # Requires healthy database
|
|
|
|
# Runtime configuration
|
|
user: ${PUID}:${PGID} # Runs as specified user/group
|
|
environment:
|
|
- GITEA__database__DB_TYPE=postgres # Database type
|
|
- GITEA__database__HOST=gitea_db:5432 # Database host
|
|
- GITEA__database__NAME=${POSTGRES_DB} # Database name
|
|
- GITEA__database__USER=${POSTGRES_USER} # Database username
|
|
- GITEA__database__PASSWD=${POSTGRES_PASSWORD} # Database password
|
|
|
|
# Persistent storage configuration
|
|
volumes:
|
|
- ${APPDATA_PATH}/gitea/config:/etc/gitea
|
|
- ${APPDATA_PATH}/gitea/data:/var/lib/gitea
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
# Network port configuration
|
|
ports:
|
|
- ${SERVER_PORT}:3000 # Maps host port to Gitea web interface
|
|
- ${SSH_PORT}:22 # Maps host port to Gitea SSH
|