binuser007 commited on
Commit
6d21f7c
·
verified ·
1 Parent(s): b456b28

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -16
Dockerfile CHANGED
@@ -1,33 +1,24 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Set working directory in the container
5
  WORKDIR /app
6
 
7
  # Set environment variables
8
  ENV PYTHONDONTWRITEBYTECODE=1 \
9
  PYTHONUNBUFFERED=1 \
10
- PORT=8080
11
 
12
- # Install dependencies first for better layer caching
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  # Copy project files
17
  COPY . .
18
 
19
- # Make sure templates directory exists
20
  RUN mkdir -p templates
21
 
22
- # Create data directory if it doesn't exist
23
- RUN mkdir -p /data && chmod 777 /data
24
 
25
- # Make port 8080 available to the world outside this container
26
- EXPOSE 8080
27
-
28
- # Define health check
29
- HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
30
- CMD curl -f http://localhost:8080/health || exit 1
31
-
32
- # Run the application when the container launches
33
- CMD ["python", "app.py"]
 
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
  # Set environment variables
6
  ENV PYTHONDONTWRITEBYTECODE=1 \
7
  PYTHONUNBUFFERED=1 \
8
+ PORT=7860
9
 
10
+ # Install dependencies
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
  # Copy project files
15
  COPY . .
16
 
17
+ # Ensure templates directory exists
18
  RUN mkdir -p templates
19
 
20
+ # Expose the port Hugging Face Spaces expects
21
+ EXPOSE 7860
22
 
23
+ # Run the application with gunicorn for better performance
24
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]