Skip to content

Docker Images for UI and Backend

  • Complexity: Moderate
  • Stack: DevOps / Full-stack

As a developer, I want to build and run the application as Docker containers so that I can deploy the frontend and backend independently in any environment.

Description

The project currently has a docker-compose.yml under docker/development/ that only runs a PostgreSQL 18 database. There are no Dockerfiles for the Spring Boot backend (onlineshopapi) or the Angular frontend (onlineshopui). This story adds production-ready Docker images for both services and extends the existing docker-compose.yml so the full application stack can be launched with a single command.

The backend is a Spring Boot 4 application built with Maven and Java 21. The frontend is an Angular 21 application using Vite for builds and should be served via a static file server in production. Both images should follow container best practices: minimal base images, multi-stage builds to reduce image size, and externalized configuration via environment variables.

Acceptance Criteria

  • [ ] A Dockerfile exists for the backend that builds and runs the Spring Boot application
  • [ ] A Dockerfile exists for the frontend that builds the Angular app and serves it via a web server
  • [ ] Both Dockerfiles use multi-stage builds to keep images small
  • [ ] docker compose up starts the database, backend, and frontend
  • [ ] The frontend is reachable in a browser and loads the Angular SPA with proper client-side routing support
  • [ ] The frontend container proxies API requests (e.g., /api/**) to the backend container
  • [ ] The backend connects to the PostgreSQL database and runs Flyway migrations on startup
  • [ ] Environment-specific values (database URL, API URL, CORS origins) are configurable via environment variables or compose file — not hardcoded in the images

Copyright © MSG Systems Romania AI Labs