services:
  blinko:
    image: "blinkospace/blinko:latest"
    container_name: ${CONTAINER_NAME}
    restart: always
    networks:
      - 1panel-network
    environment:
      NODE_ENV: production
      NEXTAUTH_URL: ${NEXTAUTH_URL}
      NEXT_PUBLIC_BASE_URL: ${NEXT_PUBLIC_BASE_URL}
      NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
      DATABASE_URL: postgresql://${PANEL_DB_USER}:${PANEL_DB_USER_PASSWORD}@${PANEL_DB_HOST}:${PANEL_DB_PORT}/${PANEL_DB_NAME}
    volumes:
      - "./data:/app/.blinko"
    ports:
      - "${PANEL_APP_PORT_HTTP}:1111"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:1111/"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 30s
    labels:
      createdBy: "Apps"
  postgres:
    image: postgres:14
    container_name: ${CONTAINER_NAME}-postgres
    restart: always
    ports:
      - ${PANEL_DB_PORT}:5432
    environment:
      POSTGRES_DB: ${PANEL_DB_NAME}
      POSTGRES_USER: ${PANEL_DB_USER}
      POSTGRES_PASSWORD: ${PANEL_DB_USER_PASSWORD}
    healthcheck:
      test:
        ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"]
      interval: 5s
      timeout: 10s
      retries: 5   

networks:
  1panel-network:
    external: true