fix(api,ci): remove type-only imports for DI and isolate CI ports from dev

- Remove `type` keyword from NestJS injectable class imports across all
  modules to fix runtime DI resolution (330+ handler/listener files)
- Offset CI docker-compose ports (5433/6380/8109/9002) to avoid
  conflicts with running dev containers
- Update .env.test, playwright.config.ts, and e2e workflow to use
  isolated CI ports with configurable overrides
- Fix prisma/seed.ts to use deterministic IDs for Prisma 7 upsert
  compatibility (phoneHash replaced phone as unique index)
- Add dedicated Docker bridge network for CI service containers

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-13 01:40:14 +07:00
parent 1617921993
commit 25420720e7
345 changed files with 3266 additions and 924 deletions

View File

@@ -1,18 +1,26 @@
# Docker Compose for CI / local E2E testing.
# Provides the minimum set of services required to run the full E2E suite.
#
# Default ports are offset from dev defaults to avoid conflicts with
# existing development containers. Override via environment or .env.ci.
#
# Usage (local):
# docker compose -f docker-compose.ci.yml up -d --wait
# docker compose --env-file .env.ci -f docker-compose.ci.yml up -d --wait
# source .env.test # load matching env vars
# pnpm db:generate && pnpm db:migrate:deploy && pnpm db:seed
# pnpm test:e2e
# docker compose -f docker-compose.ci.yml down -v
# docker compose --env-file .env.ci -f docker-compose.ci.yml down -v
#
# Usage (GitHub Actions):
# Services are defined inline in .github/workflows/e2e.yml using
# standard GH Actions service containers (ports 5432/6379/8108/9000).
services:
postgres:
image: postgis/postgis:16-3.4
container_name: goodgo-ci-postgres
ports:
- '${DB_PORT:-5432}:5432'
- '${DB_PORT:-5433}:5432'
environment:
POSTGRES_DB: goodgo_test
POSTGRES_USER: goodgo
@@ -25,41 +33,47 @@ services:
timeout: 3s
retries: 10
start_period: 10s
networks:
- goodgo-ci
redis:
image: redis:7-alpine
container_name: goodgo-ci-redis
ports:
- '${REDIS_PORT:-6379}:6379'
- '${REDIS_PORT:-6380}:6379'
command: redis-server --save "" --appendonly no
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 10
networks:
- goodgo-ci
typesense:
image: typesense/typesense:27.1
container_name: goodgo-ci-typesense
ports:
- '${TYPESENSE_PORT:-8108}:8108'
- '${TYPESENSE_PORT:-8109}:8108'
environment:
TYPESENSE_API_KEY: ts_ci_key
TYPESENSE_DATA_DIR: /data
tmpfs:
- /data
healthcheck:
test: ['CMD', 'curl', '-sf', 'http://localhost:8108/health']
test: ['CMD-SHELL', 'bash -c "echo > /dev/tcp/localhost/8108"']
interval: 5s
timeout: 3s
retries: 10
start_period: 10s
networks:
- goodgo-ci
minio:
image: minio/minio:latest
container_name: goodgo-ci-minio
ports:
- '${MINIO_PORT:-9000}:9000'
- '${MINIO_PORT:-9002}:9000'
command: server /data
environment:
MINIO_ROOT_USER: ci_minio_user
@@ -72,3 +86,10 @@ services:
timeout: 3s
retries: 10
start_period: 5s
networks:
- goodgo-ci
networks:
goodgo-ci:
driver: bridge
name: goodgo-ci