version: "3.9"

services:
  analytics-prod:
    container_name: senslog_analytics
    image: senslog/analytics
    build:
      target: production
      context: .
    ports:
      - "8080:80"

  analytics-dev:
    container_name: senslog_analytics_dev
    image: senslog/analytics-dev
    build:
      target: dev-debug
      context: .
    environment:
      - TZ=Europe/Prague
    env_file:
      - docker.dev.env
    ports:
      - "8080:8080"
      - "5005:5005"
    depends_on:
      - analytics-db

  analytics-test:
    container_name: senslog_analytics_test
    image: senslog/analytics-test
    build:
      target: test
      context: .
    environment:
      - TZ=Europe/Prague
    depends_on:
      - analytics-db

  analytics-db:
    image: postgis/postgis:15-3.3-alpine
    container_name: analytics_db
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - '5432:5432'
    volumes:
      - ./init.sql:/docker-entrypoint-initdb.d/create_tables.sql
