services:
  grafana:
    image: grafana/grafana-oss:latest
    container_name: grafana
    user: "1000:1000"
    restart: always
    environment:
      - GF_SECURITY_ADMIN_USER=${GF_USER_NAME}
      - GF_SECURITY_ADMIN_PASSWORD=${GF_USER_PASS}
      - GF_DATABASE_TYPE=${GF_DB_TYPE}
      - GF_DATABASE_HOST=${GF_DB_HOST}
      - GF_DATABASE_PORT=${GF_DB_PORT}
      - GF_DATABASE_NAME=${GF_DB_NAME}
      - GF_DATABASE_USER=${GF_DB_USER}
      - GF_DATABASE_PASSWORD=${GF_DB_PASS}
      - GF_DATABASE_MAX_IDLE_CONN=${GF_DB_IDLE}
      - GF_DATABASE_CONN_MAX_LIFETIME=${GF_DB_CONN}
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=${GF_STOR_PROVIDER}
      - GF_EXTERNAL_IMAGE_STORAGE_S3_BUCKET=${GF_S3_BUCKET}
      - GF_EXTERNAL_IMAGE_STORAGE_S3_REGION=${GF_S3_REGION}
      - GF_EXTERNAL_IMAGE_STORAGE_S3_ENDPOINT=${GF_S3_ENDPOINT}
      - GF_EXTERNAL_IMAGE_STORAGE_S3_ACCESS_KEY=${S3_KEY}
      - GF_EXTERNAL_IMAGE_STORAGE_S3_SECRET_KEY=${S3_SECRET}
    volumes:
      - ./grafana:/etc/grafana
      - ./grafana-db:/var/lib/grafana
    ports:
      - "2999:3000"