Add PostgreSQL Docker Compose service - #7
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a root-level Docker Compose configuration to run a local PostgreSQL instance for development, without changing the Spring Boot app’s current default H2 setup.
Changes:
- Introduces
compose.yamldefining apostgresservice usingpostgres:18-alpine. - Exposes PostgreSQL on port 5432 and persists data via a named volume.
- Adds a container healthcheck using
pg_isready.
Suppressed comments (1)
compose.yaml:9
- Port mapping binds PostgreSQL to all network interfaces. For a local-only dev database, bind to localhost to reduce accidental exposure on shared networks.
ports:
- "5432:5432"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| healthcheck: | ||
| test: ["CMD-SHELL", "pg_isready -U processapp -d processdb"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 10 |
| environment: | ||
| POSTGRES_DB: processdb | ||
| POSTGRES_USER: processapp | ||
| POSTGRES_PASSWORD: processapp |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55b43ff691
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - processdb-data:/var/lib/postgresql/data |
There was a problem hiding this comment.
Mount the Postgres 18 volume at the new data root
Because this service uses postgres:18-alpine, the official image docs place the live PGDATA under /var/lib/postgresql/18/docker and recommend targeting the volume at /var/lib/postgresql; mounting the named volume at the old /var/lib/postgresql/data path can leave the actual database files in an anonymous parent volume, so data disappears after a docker compose down/container recreation even though processdb-data exists. Please mount processdb-data at /var/lib/postgresql (or explicitly set PGDATA inside the mounted path) instead.
Useful? React with 👍 / 👎.
What changed
compose.yamlpg_isreadyScope
This change only adds the local PostgreSQL service. The Spring Boot application configuration remains unchanged and continues to use H2 until profiles and PostgreSQL wiring are introduced separately.
Validation