ak0601 commited on
Commit
7c05ef7
·
verified ·
1 Parent(s): f157e17

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -7
Dockerfile CHANGED
@@ -1,21 +1,21 @@
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", "flask_app:app"]
 
1
  FROM python:3.9
2
 
3
+ # Create a non-root user
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
  WORKDIR /app
9
 
10
+ # Copy and install requirements first for caching
11
  COPY --chown=user ./requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Copy the rest of the application
15
  COPY --chown=user . /app
16
 
17
+ # Set the Flask app entry point for the 'flask run' command
18
+ ENV FLASK_APP=flask_app.py
19
 
20
+ # Run the Flask app on port 7860 (common for HF Spaces) and bind to all interfaces
21
+ CMD ["python", "-m", "flask", "run", "--host", "0.0.0.0", "--port", "7860"]