services: db: container_name: postgres_container image: postgres:15.15 ports: - 5000:5432 environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} volumes: - postgres_data:/var/lib/postgresql/data restart: unless-stopped airflow: container_name: airflow_container image: apache/airflow:3.1.3 ports: - ${AIRFLOW_PORT}:8080 environment: # Database connection AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} # Custom admin credentials AIRFLOW__WEBSERVER__DEFAULT_USER_USERNAME: ${AIRFLOW_ADMIN_USER} AIRFLOW__WEBSERVER__DEFAULT_USER_PASSWORD: ${AIRFLOW_ADMIN_PASSWORD} # Airflow config AIRFLOW__CORE__LOAD_EXAMPLES: "false" AIRFLOW__CORE__EXECUTOR: LocalExecutor AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true" depends_on: - db volumes: - ./airflow/dags:/opt/airflow/dags - ./airflow/logs:/opt/airflow/logs - ./airflow/plugins:/opt/airflow/plugins command: > bash -c "airflow db migrate && airflow scheduler & exec airflow webserver" restart: unless-stopped volumes: postgres_data: airflow_logs: airflow_plugins: