Files
Git-docker-server/docker-compose.yml
T

76 lines
2.3 KiB
YAML

services:
init-permissions:
image: alpine:3.21
container_name: git-server-init-permissions
restart: "no"
environment:
USER_UID: ${USER_UID:-1000}
USER_GID: ${USER_GID:-1000}
volumes:
- ./docker/gitea:/gitea
- ./docker/postgres:/postgres
command:
- /bin/sh
- -ec
- |
chown -R "$${USER_UID}:$${USER_GID}" /gitea
chown -R 70:70 /postgres
db:
image: postgres:16-alpine
container_name: git-server-db
restart: unless-stopped
depends_on:
init-permissions:
condition: service_completed_successfully
environment:
POSTGRES_USER: ${POSTGRES_USER:-gitea}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-me-in-env}
POSTGRES_DB: ${POSTGRES_DB:-gitea}
volumes:
- ./docker/postgres:/var/lib/postgresql/data
networks:
- git-server
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gitea} -d ${POSTGRES_DB:-gitea}"]
interval: 10s
timeout: 5s
retries: 5
gitea:
image: gitea/gitea:1.24-rootless
container_name: git-server
restart: unless-stopped
depends_on:
init-permissions:
condition: service_completed_successfully
db:
condition: service_healthy
environment:
USER_UID: ${USER_UID:-1000}
USER_GID: ${USER_GID:-1000}
GITEA__database__DB_TYPE: postgres
GITEA__database__HOST: db:5432
GITEA__database__NAME: ${POSTGRES_DB:-gitea}
GITEA__database__USER: ${POSTGRES_USER:-gitea}
GITEA__database__PASSWD: ${POSTGRES_PASSWORD:-change-me-in-env}
GITEA__server__DOMAIN: ${GITEA_DOMAIN:-localhost}
GITEA__server__ROOT_URL: ${GITEA_ROOT_URL:-http://localhost:3000/}
GITEA__server__SSH_DOMAIN: ${GITEA_SSH_DOMAIN:-localhost}
GITEA__server__SSH_PORT: ${GITEA_SSH_PORT:-2222}
GITEA__service__DISABLE_REGISTRATION: ${DISABLE_REGISTRATION:-false}
GITEA__service__REQUIRE_SIGNIN_VIEW: ${REQUIRE_SIGNIN_VIEW:-false}
ports:
- "${GITEA_HTTP_PORT:-3000}:3000"
- "${GITEA_SSH_PORT:-2222}:2222"
volumes:
- ./docker/gitea:/var/lib/gitea
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- git-server
networks:
git-server:
driver: bridge