refactor: update build process to create a single all-in-one Docker image and adjust related configurations
Some checks failed
CI / Frontend Tests (pull_request) Has been cancelled
CI / Backend Tests (pull_request) Has been cancelled

This commit is contained in:
2026-03-27 16:10:14 -03:00
parent 3f0bb4be73
commit 6305a8e95e
6 changed files with 42 additions and 64 deletions

View File

@@ -15,14 +15,14 @@ You are a senior DevOps / infrastructure engineer and software architect for the
| `backend/Dockerfile` | Backend-only multi-stage build image |
| `frontend/Dockerfile` | Frontend build + Nginx image |
| `docker-compose.yml` | Dev stack (postgres + backend + nginx + mailhog) |
| `docker-compose.prod.yml` | Prod stack (postgres + backend + nginx, no mailhog) |
| `docker-compose.prod.yml` | Prod stack (single all-in-one image) |
| `nginx/nginx.conf` | Nginx config for multi-container compose flavours |
| `nginx/nginx.allinone.conf` | Nginx config for the all-in-one image (localhost backend) |
| `frontend/nginx.docker.conf` | Nginx config embedded in frontend image |
| `docker/supervisord.conf` | Supervisor config (manages postgres + java + nginx inside allinone) |
| `docker/entrypoint.sh` | Allinone container entrypoint (DB init, env wiring, supervisord start) |
| `.gitea/workflows/ci.yml` | CI: backend tests + frontend tests on pull requests to `develop` |
| `.gitea/workflows/build.yml` | Build: create local backend/frontend images on approved PRs to `main` |
| `.gitea/workflows/build.yml` | Build: create the local all-in-one image on approved PRs to `main` |
| `.env.example` | Template for all environment variables |
## System Topology
@@ -54,7 +54,7 @@ Docker volume → /var/lib/postgresql/data
| Flavour | Command | Notes |
|---|---|---|
| Dev | `docker compose up --build` | Includes Mailhog on :1025/:8025 |
| Prod (compose) | `docker compose -f docker-compose.prod.yml up -d` | External DB/SMTP using prebuilt local images |
| Prod (compose) | `docker compose -f docker-compose.prod.yml up -d` | Prebuilt all-in-one image with internal PostgreSQL |
| All-in-one | `docker run -p 80:80 -e APP_PASSWORD=... <image>` | Everything in one container |
## Key Environment Variables
@@ -81,9 +81,9 @@ All injected at runtime — never hardcoded in images.
| Workflow | Trigger | What it does |
|---|---|---|
| `ci.yml` | Pull request to `develop` | Backend `./gradlew test` + Frontend `npm run test` |
| `build.yml` | Approved PR review to `main` | Builds `condado-newsletter-backend` and `condado-newsletter-frontend` on the target Docker host |
| `build.yml` | Approved PR review to `main` | Builds `condado-newsletter` on the target Docker host |
The runner shares the target Docker host, so this workflow produces local images directly on that host. `docker-compose.prod.yml` must reference images and not local build directives.
The runner shares the target Docker host, so this workflow produces the local `condado-newsletter` image directly on that host. `docker-compose.prod.yml` must reference that image and not local build directives.
## Implementation Rules