Download Dockerfile from DaCrow13/Hopcroft-Skill-Classification: direct link, hf CLI and curl.
- Browser
- Download file 3.23 kB
-
https://huggingface.co/spaces/DaCrow13/Hopcroft-Skill-Classification/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/DaCrow13/Hopcroft-Skill-Classification/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/DaCrow13/Hopcroft-Skill-Classification/resolve/main/Dockerfile
3.23 kB
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=off \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=on \ | |
| PIP_DEFAULT_TIMEOUT=100 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| dos2unix \ | |
| nginx \ | |
| procps \ | |
| curl \ | |
| prometheus \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| # Set working directory | |
| WORKDIR /app | |
| # Grafana | |
| RUN apt-get update && apt-get install -y wget apt-transport-https && \ | |
| wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key && \ | |
| echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | tee /etc/apt/sources.list.d/grafana.list && \ | |
| apt-get update && \ | |
| apt-get install -y grafana && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Prometheus | |
| RUN wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz && \ | |
| tar xvfz prometheus-*.tar.gz && \ | |
| mv prometheus-*/prometheus /usr/local/bin/ && \ | |
| mv prometheus-*/promtool /usr/local/bin/ && \ | |
| mkdir -p /etc/prometheus /var/lib/prometheus && \ | |
| rm -rf prometheus-* | |
| # Alertmanager | |
| RUN wget https://github.com/prometheus/alertmanager/releases/download/v0.25.0/alertmanager-0.25.0.linux-amd64.tar.gz && \ | |
| tar xvfz alertmanager-*.tar.gz && \ | |
| mv alertmanager-*/alertmanager /usr/local/bin/ && \ | |
| mv alertmanager-*/amtool /usr/local/bin/ && \ | |
| mkdir -p /etc/alertmanager /var/lib/alertmanager && \ | |
| rm -rf alertmanager-* | |
| # Pushgateway | |
| RUN wget https://github.com/prometheus/pushgateway/releases/download/v1.6.0/pushgateway-1.6.0.linux-amd64.tar.gz && \ | |
| tar xvfz pushgateway-*.tar.gz && \ | |
| mv pushgateway-*/pushgateway /usr/local/bin/ && \ | |
| rm -rf pushgateway-* | |
| COPY --chown=user monitoring/grafana/provisioning /etc/grafana/provisioning | |
| COPY --chown=user monitoring/grafana/dashboards /var/lib/grafana/dashboards | |
| COPY --chown=user monitoring/prometheus/prometheus.yml /etc/prometheus/prometheus.yml | |
| COPY --chown=user monitoring/prometheus/alert_rules.yml /etc/prometheus/alert_rules.yml | |
| COPY --chown=user monitoring/alertmanager/config.yml /etc/alertmanager/config.yml | |
| # Copy requirements first for caching | |
| COPY requirements.txt . | |
| # Remove -e . from requirements.txt to avoid installing the project before copying it | |
| # and install dependencies | |
| RUN sed -i '/-e \./d' requirements.txt && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY --chown=user:user . . | |
| # Ensure the user has permissions on the app directory (needed for dvc init if .dvc is missing) | |
| RUN chown -R user:user /app | |
| # Fix line endings and permissions for the start script and configs | |
| RUN find . -name "*.sh" -o -name "*.yml" -o -name "*.ini" -o -name "*.json" | xargs dos2unix && \ | |
| chmod +x docker/scripts/start_space.sh | |
| # Install the project itself | |
| RUN pip install --no-cache-dir . | |
| # Make start script executable | |
| RUN chmod +x docker/scripts/start_space.sh | |
| # Switch to non-root user | |
| USER user | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["./docker/scripts/start_space.sh"] | |