From d4cffe2407e48075de0a404635458d8da78d298b Mon Sep 17 00:00:00 2001 From: Hammy <58985301+sgoudham@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:40:26 +0000 Subject: [PATCH] tests: add docker compose for easy testing (#54) --- docker/.gitignore | 3 ++ docker/docker-compose.yml | 59 +++++++++++++++++++++++++++++++++++++++ docker/justfile | 13 +++++++++ 3 files changed, 75 insertions(+) create mode 100644 docker/.gitignore create mode 100644 docker/docker-compose.yml create mode 100644 docker/justfile diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..d5efab1 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1,3 @@ +* +!docker/docker-compose.yml +!docker/justfile diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..ee5fc1b --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,59 @@ +services: + server: + image: gitea/gitea:1.22.3 + container_name: gitea + restart: unless-stopped + environment: + - USER_UID=1000 + - USER_GID=1000 + - GITEA__database__DB_TYPE=postgres + - GITEA__database__HOST=db:5432 + - GITEA__database__NAME=gitea + - GITEA__database__USER=gitea + - GITEA__database__PASSWD=gitea + networks: + - gitea + volumes: + # - ./conf/app.ini:/data/gitea/conf/app.ini + - type: bind + source: ./conf/app.ini + target: /data/gitea/conf/app.ini + - ./conf/public:/data/gitea/public + - ./conf/templates:/data/gitea/templates + - ./conf/locale:/data/gitea/options/locale + - ./data:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "222:22" + depends_on: + db: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-fSs", "localhost:3000/api/healthz"] + interval: "30s" + timeout: "5s" + retries: 3 + + db: + image: postgres:14 + restart: unless-stopped + environment: + - POSTGRES_USER=gitea + - POSTGRES_PASSWORD=gitea + - POSTGRES_DB=gitea + networks: + - gitea + volumes: + - ./postgres:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] + interval: "5s" + timeout: "5s" + retries: 3 + +networks: + gitea: + name: "gitea" + external: false diff --git a/docker/justfile b/docker/justfile new file mode 100644 index 0000000..a577ae0 --- /dev/null +++ b/docker/justfile @@ -0,0 +1,13 @@ +_default: + @just --list + +build: + cd .. && deno task build + mkdir -p ./conf/public/assets/css + cp ../dist/* ./conf/public/assets/css + +down: + docker compose down + +up: build down + docker compose up -d