version: '3.9' services: frontend: container_name: frontend image: frontend build: context: ./frontend dockerfile: frontend.dockerfile ports: - 3000:3000 environment: - NEXT_PUBLIC_API_URL=http://localhost:4000 restart: always depends_on: - backend backend: container_name: backend image: backend build: context: ./backend dockerfile: backend.dockerfile ports: - 4000:4000 environment: - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?schema=public db: container_name: db image: postgres:12 restart: always environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: postgres ports: - 5432:5432 volumes: - pgdata:/var/lib/postgresql/data volumes: pgdata: {}