airflow / Dockerfile
Subham9126's picture
Create Dockerfile
27c3627 verified
Raw
History Blame
875 Bytes
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)"]