# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

services:
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: quickbot-text-to-imagen-backend
    ports:
      - "8080:8080"
    volumes:
      - ./backend:/app
      # Mount the gcloud ADC directory. Replace with the correct path for your OS if different. :ro - read-only for better security
      - ~/.config/gcloud/:/root/.config/gcloud:ro # Linux/macOS example:
      # - %APPDATA%/gcloud:/root/.config/gcloud:ro # Windows example:
    environment:
      ENVIRONMENT: development
      FRONTEND_URL: http://localhost:4200
      GCLOUD_PROJECT: my-project-id
      GOOGLE_APPLICATION_CREDENTIALS: "/root/.config/gcloud/application_default_credentials.json"
    restart: unless-stopped

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: quickbot-text-to-imagen-frontend
    ports:
      - "4200:8080"
    volumes:
      - ./frontend:/app
      # Use an anonymous volume for node_modules to prevent host node_modules
      # from interfering and potentially speed up builds/rebuilds
      - /app/node_modules
    # To change the env variables in the frontend, change the environment.ts file
    restart: unless-stopped