Nginx server not working with Postgres and .NET Core

After many hours of frustrating attempts I’m asking help:

I have a .NET Core App that regardless of my searches online doesn’t seem to start in Docker.

It should be working because is the final assignment of a Docker course so I’m pretty sure that I’m miscomputing my Dockerfile. Here it is:

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build

WORKDIR /app
COPY . ./

RUN dotnet restore
RUN dotnet publish -c Release -o out

#EXPOSE 5000:5001

ENTRYPOINT dotnet out/backend.dll

This is the docker-compose.yml:

version: '3.9'

services:
  db:
    container_name: 'db'
    build: 
      context: ./postgres/
      dockerfile: ./Dockerfile
    ports:
      - "5432"
    networks:
      - marco-network

  backend:
    container_name: 'backend'
    depends_on:
      - db
    build: 
      context: ./backend/
      dockerfile: ./Dockerfile
    # volumes:
    #   - ./src:/usr/share/nginx/html
    environment:
      - ConnectionStrings__DefaultConnection=Host=db;database=message;Username=postgres;Password=6AX3PwqM47fZAHw9
    ports:
      - 5000:5001
    networks:
      - marco-network
    
  frontend:
    container_name: 'frontend'
    depends_on:
      - backend
    build:
      context: ./frontend/
      dockerfile: ./Dockerfile
    ports:
      - 8080:80
    networks:
      - marco-network
  
  
networks:
  marco-network:
    name: marco-network
    driver: bridge

At this point all the three containers are running without any apparent error, but no access to the back end from front end and of course no data fetching from database.

All the three components are working individually without any issue inside and outside Docker.

Any help is really appreciated, I’ve spent around 20 hours on this problem without any success.