version: '3.8'

services:
  postgres:
    image: postgres:15-alpine
    container_name: vida180_postgres
    environment:
      POSTGRES_DB: vida180_db
      POSTGRES_USER: vida180_user
      POSTGRES_PASSWORD: vida180_password
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./backend/init.sql:/docker-entrypoint-initdb.d/init.sql
    ports:
      - "5433:5432"
    networks:
      - vida180_network

  redis:
    image: redis:7-alpine
    container_name: vida180_redis
    ports:
      - "6380:6379"
    networks:
      - vida180_network

  backend:
    build: ./backend
    container_name: vida180_backend
    environment:
      DATABASE_URL: postgresql://vida180_user:vida180_password@postgres:5432/vida180_db
      REDIS_URL: redis://redis:6379
      SECRET_KEY: your-secret-key-change-this-in-production
      ALGORITHM: HS256
      ACCESS_TOKEN_EXPIRE_MINUTES: 10080
    ports:
      - "8000:8000"
    depends_on:
      - postgres
      - redis
    networks:
      - vida180_network

  frontend:
    build: ./frontend
    container_name: vida180_frontend
    ports:
      - "3200:3000"
    depends_on:
      - backend
    networks:
      - vida180_network

volumes:
  postgres_data:

networks:
  vida180_network:
    driver: bridge
