Spaces:
Sleeping
Sleeping
| FROM ubuntu:22.04 | |
| LABEL maintainer="subhamgiri460" | |
| LABEL description="Apache Airflow on HuggingFace Docker Space" | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV AIRFLOW_HOME=/opt/airflow | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # ---- System packages ---- | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| nginx \ | |
| git \ | |
| supervisor \ | |
| curl \ | |
| libpq-dev \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && useradd -m -u 1000 airflow | |
| # ---- Directories & permissions ---- | |
| RUN mkdir -p \ | |
| /var/log/supervisor \ | |
| /var/log/nginx \ | |
| /run/nginx \ | |
| /var/lib/nginx \ | |
| /run/nginx/client_temp \ | |
| /run/nginx/proxy_temp \ | |
| /run/nginx/fastcgi_temp \ | |
| /run/nginx/uwsgi_temp \ | |
| /run/nginx/scgi_temp \ | |
| /opt/airflow/dags \ | |
| /opt/airflow/logs \ | |
| && chown -R airflow:airflow \ | |
| /opt/airflow \ | |
| /var/log/supervisor \ | |
| /var/log/nginx \ | |
| /run/nginx \ | |
| /var/lib/nginx | |
| USER airflow | |
| ENV PATH="/home/airflow/.local/bin:${PATH}" | |
| # ---- Python dependencies (cached layer) ---- | |
| COPY --chown=airflow:airflow requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r /tmp/requirements.txt \ | |
| && rm /tmp/requirements.txt | |
| # ---- Application files ---- | |
| COPY --chown=airflow:airflow config.sh /config.sh | |
| COPY --chown=airflow:airflow supervisord.conf /etc/supervisord.conf | |
| COPY --chown=airflow:airflow nginx.conf /etc/nginx/nginx.conf | |
| COPY --chown=airflow:airflow entrypoint.sh /entrypoint.sh | |
| COPY --chown=airflow:airflow refresh_service.py /refresh_service.py | |
| RUN chmod +x /entrypoint.sh /config.sh | |
| # ---- Health check ---- | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \ | |
| CMD curl -sf http://localhost:7860/health || exit 1 | |
| EXPOSE 7860 | |
| ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] |