version: '3.8'

services:
  web:
    build:
      context: .
      dockerfile: Dockerfile.local
    image: links-app-local
    command: >
      bash -c "python manage.py migrate &&
               python manage.py runserver 0.0.0.0:8000"
    volumes:
      - ./data/media:/app/data/media
      - ./data/db.sqlite3:/app/data/db.sqlite3
      - playwright-browsers:/app/.playwright
    ports:
      - "8000:8000"
    env_file:
      - .env
    environment:
      - DJANGO_SETTINGS_MODULE=core.settings
      - PLAYWRIGHT_BROWSERS_PATH=/app/.playwright
    restart: unless-stopped
    networks:
      - app-network

  node:
    build:
      context: .
      dockerfile: Dockerfile.local
    image: links-app-local
    working_dir: /app/new_theme/static_src
    command: bash -c "npm install && npm run dev"
    volumes:
      - ./new_theme/static_src:/app/new_theme/static_src
      - ./new_theme/static:/app/new_theme/static
      - node_modules:/app/new_theme/static_src/node_modules
    environment:
      - NODE_ENV=development
    depends_on:
      web:
        condition: service_started
    networks:
      - app-network
    tty: true
    stdin_open: true

volumes:
  node_modules:
  playwright-browsers:

networks:
  app-network:
    driver: bridge
