broadfield-dev commited on
Commit
4b30e2b
·
verified ·
1 Parent(s): 4482d63

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -7
Dockerfile CHANGED
@@ -18,19 +18,26 @@ WORKDIR /app
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
- # Copy the app code
22
  COPY app.py .
 
 
 
23
 
24
  # Switch to non-root user
25
  USER appuser
26
 
27
- # Expose the port Gradio will run on
 
28
  EXPOSE 7860
29
 
30
  # Set environment variables
31
- ENV GRADIO_SERVER_NAME="0.0.0.0"
32
- ENV GRADIO_SERVER_PORT=7860
33
  ENV PYTHONUNBUFFERED=1
34
-
35
- # Run the Gradio app
36
- CMD ["python", "app.py"]
 
 
 
 
 
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy the app code and templates
22
  COPY app.py .
23
+ COPY templates /app/templates/
24
+ # If you add a static folder in the future for CSS/JS:
25
+ # COPY static /app/static/
26
 
27
  # Switch to non-root user
28
  USER appuser
29
 
30
+ # Expose the port the app runs on (for documentation, HF handles actual mapping)
31
+ # Gunicorn will bind to this port. Hugging Face Spaces typically expect apps on 7860.
32
  EXPOSE 7860
33
 
34
  # Set environment variables
 
 
35
  ENV PYTHONUNBUFFERED=1
36
+ ENV FLASK_APP=app.py
37
+ # Recommended: Set FLASK_ENV to production for real deployments,
38
+ # but gunicorn handles this role better than Flask dev server.
39
+ # ENV FLASK_ENV=production
40
+
41
+ # Run the Flask app with Gunicorn
42
+ # The 'app:app' means Gunicorn should look for an object named 'app' in a file named 'app.py'.
43
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]