services: frontend: build: context: ./frontend container_name: vinyl-frontend volumes: - ./frontend:/app - /app/node_modules # Prevents the node_modules directory from being overridden by the container # (avoid conflicts between the dependencies installed on the host machine and those installed inside the container) - ./database/sample_data/images:/app/media # Shared volume for album art and other media files environment: - REACT_APP_API_BASE_URL # `/api` - CHOKIDAR_INTERVAL=100 - CHOKIDAR_USEPOLLING # File change detection for reload - WDS_SOCKET_PORT=0 # Use the default Webpack Dev Server socket port (needed for hot reloading) env_file: - .env depends_on: - backend # Only startup after the backend service is up networks: - vinyl-network # Local backend changes are automatically reflected in the container upon saving # (Exception: changes to the Dockerfile require a rebuild) backend: build: context: ./backend container_name: vinyl-backend volumes: - ./backend:/app - ./database/sample_data/images:/media - ./database/sample_data/import-albums.csv:/app/import-albums.csv - ./database/sample_data/import-songs.csv:/app/import-songs.csv - ./debugging_imgs:/app/debugging_imgs environment: - DATABASE_URL - MEDIA_DIR - NUMBA_DEBUG=0 env_file: - .env depends_on: database: # Ensure the database container starts before the backend condition: service_healthy networks: - vinyl-network # If renaming this service, update DATABASE_URL in the .env file! database: image: postgres:15 container_name: vinyl-database build: context: ./database healthcheck: test: [ "CMD", "pg_isready", "-U", "postgres" ] interval: 10s timeout: 5s retries: 5 volumes: - postgres_data:/var/lib/postgresql/data # Persistent storage for the database data (allows data to outlive container restarts/builds) - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # Initialize the database with our custom SQL init script - ./database/sample_data/images:/media environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: vinyl_db env_file: - .env networks: - vinyl-network pgadmin: image: dpage/pgadmin4:latest container_name: pgadmin env_file: - .env volumes: - ./pgadmin/servers.json:/pgadmin4/servers.json:ro # Pre-configured servers.json file depends_on: database: condition: service_healthy networks: - vinyl-network nginx: image: nginx:latest container_name: vinyl-nginx ports: - "80:80" volumes: - ./frontend/build:/usr/share/nginx/html:ro - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - ./nginx/favicon.ico:/etc/nginx/favicon.ico:ro - ./database/sample_data/images:/media:ro depends_on: - frontend - backend - database networks: - vinyl-network volumes: postgres_data: # Define a persistent volume for the PostgreSQL database (to outlive container restarts) networks: vinyl-network: # Custom network for inter-container communication