I created a spring boot (3.0) backend application and used an angular frontend for it. I want to use the frontend-maven-plugin to put the frontend in the static folder of the spring boot application. This works as long as I run the application in a local environment, but when I create a docker image of it, the frontend and backend can no longer communicate with each other due to a cors error.
My docker-compose file looks like this:
version: '3.8'
services:
db:
image: postgres:latest
restart: always
...
app:
image: <dockerImage>
restart: always
ports:
- "8080:8080"
depends_on:
- db
volumes:
dbdata:
In the angular application, the environment.ts contains this:
baseUrl: 'http://localhost:8080/api/'
How to configure the frontend to be able to communicate with the backend in the docker container? I am not a frontend developer, and this is for learning purposes only :) Thank you for your answers!