commit f3105b8cac6c8726e488c90f1fcacf1c34a154d0 Author: ngc2207 Date: Thu Dec 5 00:46:36 2024 +0800 gitea & postgres diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..db33e37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# env files +.env* \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b2ab526 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,51 @@ +networks: + judge4c-network: + name: judge4c-network + driver: bridge + +volumes: + judge4c-gitea-vol: + name: judge4c-gitea-vol + driver: local + judge4c-postgres-vol: + name: judge4c-postgres-vol + driver: local + +services: + judge4c-postgres: + image: postgres:14 + container_name: judge4c-postgres + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + restart: always + networks: + - judge4c-network + volumes: + - judge4c-postgres-vol:/var/lib/postgresql/data + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ] + interval: 10s + timeout: 5s + retries: 5 + + judge4c-gitea: + image: gitea/gitea:1.22.4 + container_name: judge4c-gitea + environment: + DB_TYPE: postgres + DB_HOST: judge4c-postgres:5432 + DB_NAME: ${POSTGRES_DB} + DB_USER: ${POSTGRES_USER} + DB_PASSWD: ${POSTGRES_PASSWORD} + restart: always + networks: + - judge4c-network + volumes: + - judge4c-gitea-vol:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + depends_on: + judge4c-postgres: + condition: service_healthy