Implements tasks T001-T016, T018-T022, T024-T026 from specs/001-ci-pipeline/tasks.md (T017/T023 need a real Jenkins instance to verify and are left for manual follow-up). - Add Jenkinsfile: checkout -> install -> environment validation -> typecheck -> lint (+ architecture check) -> format check -> unit -> integration -> E2E -> build -> Docker build -> publish -> deploy, matching the constitution's required stage order. Secrets are always injected from Jenkins credentials at runtime, never read from a repo-committed file. Publish/Deploy are skipped (not failed) on branches with no resolved deploy target. - Fix docker-compose.test.yml: remove fixed container_name on app/postgres/redis, which would have made concurrent CI runs collide (FR-009). Verified locally that two runs under different -p project names no longer share container/volume/network names. - Document the pipeline and local .env setup in README.md. - Mark completed tasks in specs/001-ci-pipeline/tasks.md and record the container_name/compose-down-env-file findings in the spec's requirements checklist notes. Locally verified passing: Dockerfile build, typecheck, lint, architecture check, format check, unit test suite, and the edited docker-compose.test.yml bringing up postgres/redis with isolated per-project container names. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
82 lines
1.4 KiB
YAML
82 lines
1.4 KiB
YAML
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
BUILD_COMMAND: ${BUILD_COMMAND}
|
|
|
|
env_file:
|
|
- .env.test
|
|
|
|
environment:
|
|
NODE_ENV: ${NODE_ENV}
|
|
PORT: ${PORT}
|
|
DATABASE_URL: ${DATABASE_URL}
|
|
REDIS_HOST: ${REDIS_HOST}
|
|
REDIS_PORT: ${REDIS_PORT}
|
|
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
|
|
ports:
|
|
- "${PORT}:${PORT}"
|
|
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
restart: unless-stopped
|
|
|
|
postgres:
|
|
image: postgres:18-alpine
|
|
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
|
|
volumes:
|
|
- postgres_test_data:/var/lib/postgresql
|
|
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL",
|
|
"pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"
|
|
]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
|
|
command:
|
|
- redis-server
|
|
- --requirepass
|
|
- ${REDIS_PASSWORD}
|
|
|
|
volumes:
|
|
- redis_test_data:/data
|
|
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD",
|
|
"redis-cli",
|
|
"-a",
|
|
"${REDIS_PASSWORD}",
|
|
"ping"
|
|
]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_test_data:
|
|
redis_test_data: |