File size: 875 Bytes
27c3627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM apache/airflow:2.10.0-python3.11

# Port 7860 is required for HF Spaces
ENV AIRFLOW__WEBSERVER__WEB_SERVER_PORT=7860
ENV AIRFLOW__CORE__LOAD_EXAMPLES=False
ENV AIRFLOW_HOME=/opt/airflow

USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

USER airflow

# Copy DAGs and requirements
COPY --chown=airflow:0 dags/ /opt/airflow/dags/
COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

# Initialize DB, Create Admin User, and Start Services
# We use 'airflow db init' for local SQLite testing
ENTRYPOINT ["/usr/bin/bash", "-c"]
CMD ["airflow db init && \
      airflow users create --username admin --password admin --firstname Jack --lastname Sparrow --role Admin --email admin@example.com && \
      (airflow scheduler & airflow webserver)"]