2025-12-03 11:22:50 -05:00
|
|
|
version: '3.8'
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
# --- 1. Spring API Service (Backend) ---
|
2025-12-03 11:34:08 -05:00
|
|
|
ss_builder-api:
|
2025-12-03 11:22:50 -05:00
|
|
|
build:
|
|
|
|
|
context: ./backend # Path to your Spring project's root folder
|
|
|
|
|
dockerfile: Dockerfile # Assumes you have a Dockerfile in ./backend
|
2025-12-03 11:34:08 -05:00
|
|
|
container_name: ss_builder-api
|
2025-12-03 11:22:50 -05:00
|
|
|
ports:
|
|
|
|
|
- "8080:8080" # Map host port 8080 to container port 8080
|
|
|
|
|
environment:
|
|
|
|
|
# These environment variables link the API to the database service defined below
|
2025-12-03 11:34:08 -05:00
|
|
|
- SPRING_DATASOURCE_URL=jdbc:postgresql://r710.dev.gofwd.group:5433/ss_builder
|
|
|
|
|
- SPRING_DATASOURCE_USERNAME=dba
|
|
|
|
|
- SPRING_DATASOURCE_PASSWORD=!@#Qwerty
|
2025-12-03 11:22:50 -05:00
|
|
|
networks:
|
|
|
|
|
- app-network
|
|
|
|
|
|
|
|
|
|
# --- 2. Next.js App Service (Frontend) ---
|
|
|
|
|
nextjs-app:
|
|
|
|
|
build:
|
|
|
|
|
context: ./frontend # Path to your Next.js project's root folder
|
|
|
|
|
dockerfile: Dockerfile # Assumes you have a Dockerfile in ./frontend
|
2025-12-03 11:34:08 -05:00
|
|
|
container_name: ss_builder-app
|
2025-12-03 11:22:50 -05:00
|
|
|
ports:
|
|
|
|
|
- "3000:3000" # Map host port 3000 to container port 3000
|
|
|
|
|
environment:
|
|
|
|
|
# This variable is crucial: Next.js needs the URL for the Spring API
|
|
|
|
|
# Use the Docker internal service name 'spring-api' and its port 8080
|
2025-12-03 11:34:08 -05:00
|
|
|
- NEXT_PUBLIC_API_URL=http://ss_builder-api:8080
|
2025-12-03 11:22:50 -05:00
|
|
|
# For local testing, you might need the host IP for Next.js to call back
|
|
|
|
|
# - NEXT_PUBLIC_API_URL_LOCAL=http://localhost:8080
|
|
|
|
|
depends_on:
|
2025-12-03 11:34:08 -05:00
|
|
|
- ss_builder-api
|
2025-12-03 11:22:50 -05:00
|
|
|
networks:
|
|
|
|
|
- app-network
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Docker Network for Inter-Container Communication ---
|
|
|
|
|
networks:
|
|
|
|
|
app-network:
|
2025-12-02 17:18:26 -05:00
|
|
|
driver: bridge
|