SalexAI commited on
Commit
fe08d0c
·
verified ·
1 Parent(s): bae2c03

Update dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +11 -25
dockerfile CHANGED
@@ -1,30 +1,16 @@
1
- # Use an official lightweight Python image
2
- FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
 
8
- # Set working directory
9
- WORKDIR /app
10
-
11
- # Install system dependencies (optional, add more if needed)
12
- RUN apt-get update && apt-get install -y --no-install-recommends \
13
- build-essential \
14
- git \
15
- && rm -rf /var/lib/apt/lists/*
16
-
17
- # Copy requirements file if it exists
18
- COPY requirements.txt .
19
 
20
- # Install Python dependencies
21
- RUN pip install --no-cache-dir -r requirements.txt
22
-
23
- # Copy app files
24
- COPY . .
25
 
26
- # Expose the port that HF Spaces expects (default 7860 for Gradio, Streamlit, etc.)
27
- EXPOSE 7860
28
 
29
- # Command to run the app
30
- CMD ["python", "app.py"]
 
1
+ # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
 
4
+ FROM python:3.9
 
 
5
 
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ ENV PATH="/home/user/.local/bin:$PATH"
 
 
 
 
 
 
 
 
9
 
10
+ WORKDIR /app
 
 
 
 
11
 
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
15
+ COPY --chown=user . /app
16
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]