Yoonc commited on
Commit
fc6179a
·
verified ·
1 Parent(s): 0bfb426

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -20
Dockerfile CHANGED
@@ -1,28 +1,21 @@
1
- # Use the official lightweight Python image
2
- FROM python:3.10-slim
3
 
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Copy project files
8
- COPY example.py /app/
9
- COPY templates/ /app/templates/
10
 
 
11
 
 
 
12
 
13
- # Copy your dependency file if it exists (optional)
14
- # If not, we’ll create one on the fly
15
- RUN echo "Flask==3.0.3\npython-dotenv\nTogether==0.2.8" > requirements.txt
16
 
17
- # Install Python dependencies
18
- RUN pip install --no-cache-dir -r requirements.txt
19
 
20
- # Expose port 7860 (required by Hugging Face Spaces)
21
  EXPOSE 7860
22
 
23
- # Set environment variables
24
- ENV PORT=7860
25
- ENV PYTHONUNBUFFERED=1
26
-
27
- # Start the Flask app
28
- CMD ["python", "example.py"]
 
1
+ FROM python:3.9
 
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
 
14
+ # Install Flask
15
+ RUN pip install flask gunicorn pymupdf tiktoken
16
 
17
+ # Expose default port
18
  EXPOSE 7860
19
 
20
+ # Run with Gunicorn
21
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]