wolfofbackstreet commited on
Commit
9f25ef7
·
verified ·
1 Parent(s): 3b80f4a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -10
Dockerfile CHANGED
@@ -1,16 +1,23 @@
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.11
 
 
 
 
 
 
 
 
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 ["flask", "run", "--port=7860"]
 
1
+ # Use the official Python slim image for a smaller footprint
2
+ FROM python:3.11-slim
3
 
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Copy requirements and install dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy the Flask app code
12
+ COPY . .
13
 
14
+ # Create a non-root user for security (Hugging Face requirement)
15
  RUN useradd -m -u 1000 user
16
  USER user
17
+ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
 
 
18
 
19
+ # Expose port 7860 (required by Hugging Face)
20
+ EXPOSE 7860
21
 
22
+ # Run the Flask app with Gunicorn
23
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]