Spaces:
Runtime error
Runtime error
| # Use the official Apache Airflow image as a base | |
| FROM apache/airflow:2.7.0 AS base | |
| # Set essential environment variables | |
| ENV AIRFLOW_HOME=/opt/airflow \ | |
| AIRFLOW__CORE__LOAD_EXAMPLES=False \ | |
| AIRFLOW__CORE__EXECUTOR=SequentialExecutor \ | |
| AIRFLOW__WEBSERVER__WEB_SERVER_MASTER_TIMEOUT=300 \ | |
| AIRFLOW__WEBSERVER__WORKER_CLASS=gevent \ | |
| AIRFLOW__WEBSERVER__WEB_SERVER_PORT=7860 \ | |
| AIRFLOW__WEBSERVER__COOKIE_SECURE=False \ | |
| AIRFLOW__WEBSERVER__COOKIE_SAMESITE=None \ | |
| AIRFLOW__WEBSERVER__ENABLE_PROXY_FIX=True \ | |
| AIRFLOW__WEBSERVER__BASE_URL="https://arthurcornelio88-airflow-server.hf.space" \ | |
| AIRFLOW__WEBSERVER__SECRET_KEY="" \ | |
| AIRFLOW__WEBSERVER__COOKIE_SECRET="" | |
| # Install Google Cloud SDK and dependencies | |
| USER root | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl jq gnupg iproute2 procps && \ | |
| curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ | |
| echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list && \ | |
| apt-get update && apt-get install -y --no-install-recommends google-cloud-sdk && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Ensure `airflow` user has correct UID | |
| RUN usermod -u 1000 airflow | |
| # Switch to `airflow` user before installing Python dependencies | |
| USER airflow | |
| # Install Python dependencies | |
| COPY --chown=airflow:airflow requirements.txt /opt/airflow/requirements.txt | |
| RUN pip install --no-cache-dir -r /opt/airflow/requirements.txt | |
| # Switch back to root to copy DAGs and scripts | |
| USER root | |
| COPY --chown=airflow:airflow ./dags /opt/airflow/dags | |
| COPY --chown=airflow:airflow start.sh /opt/airflow/start.sh | |
| COPY --chown=airflow:airflow ./scripts/csrf_debug.py /opt/airflow/csrf_debug.py | |
| RUN chmod +x /opt/airflow/start.sh | |
| # Switch back to `airflow` user for execution | |
| USER airflow | |
| # Run the startup script at runtime | |
| ENTRYPOINT ["/bin/bash", "/opt/airflow/start.sh"] | |