pritmanvar commited on
Commit
866fbd4
·
verified ·
1 Parent(s): fbd9e3e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -14
Dockerfile CHANGED
@@ -1,18 +1,13 @@
1
- # Dockerfile for deploying the FastAPI app on Hugging Face Spaces or any Docker environment
2
- FROM python:3.10-slim
3
 
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install Python dependencies
8
- COPY requirements.txt ./
9
- RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy application code
12
- COPY . .
13
 
14
- # Expose port (Hugging Face Spaces uses port 80)
15
- EXPOSE 80
16
 
17
- # Run the FastAPI app with Gunicorn and Uvicorn worker
18
- CMD ["gunicorn", "app:app", "--workers", "1", "--bind", "0.0.0.0:80", "--worker-class", "uvicorn.workers.UvicornWorker"]
 
1
+ FROM python:3.10
 
2
 
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
+ ENV PATH="/home/user/.local/bin:$PATH"
 
 
 
6
 
7
+ WORKDIR /app
 
8
 
9
+ COPY --chown=user ./requirements.txt requirements.txt
10
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
12
+ COPY --chown=user . /app
13
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]