Spaces:
Build error
Build error
Download Dockerfile from starkbyte45896/Ravi: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/spaces/starkbyte45896/Ravi/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/starkbyte45896/Ravi/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/starkbyte45896/Ravi/resolve/main/Dockerfile
1.32 kB
| # π Use an official lightweight Python image | |
| FROM python:3.10-slim as builder | |
| # π Install system dependencies (OpenSSL for TLS & CA Certificates) | |
| RUN apt-get update && apt-get install -y \ | |
| libssl-dev \ | |
| ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* # Clean up package lists | |
| # π Set the working directory inside the container | |
| WORKDIR /app | |
| # π¦ Copy and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # π Final Production Image | |
| FROM python:3.10-slim | |
| # π Set the working directory inside the container | |
| WORKDIR /app | |
| # π Copy installed dependencies from builder stage | |
| COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages | |
| COPY --from=builder /usr/local/bin /usr/local/bin | |
| # π Copy the entire application code into the container | |
| COPY . . | |
| # π Set secure environment variables (MongoDB URI) | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV MONGO_USER="Ravi" | |
| ENV MONGO_PASS="Aditya@2006@#" | |
| ENV MONGO_CLUSTER="ravi.btpy9.mongodb.net" | |
| ENV MONGO_URI="mongodb+srv://${MONGO_USER}:${MONGO_PASS}@${MONGO_CLUSTER}/?retryWrites=true&w=majority&tls=true" | |
| # πͺ Expose Flask application port | |
| EXPOSE 7860 | |
| # π Start the Flask app with Gunicorn (4 workers) | |
| CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"] | |