Pamudu13 commited on
Commit
abac4f7
·
verified ·
1 Parent(s): 95b2f15

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -20
Dockerfile CHANGED
@@ -1,29 +1,21 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.9-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONUNBUFFERED=1 \
6
- PORT=7860
7
 
8
- # Set the working directory in the container
9
- WORKDIR /code
10
 
11
- # Install system dependencies
12
- RUN apt-get update && apt-get install -y \
13
- build-essential \
14
- && rm -rf /var/lib/apt/lists/*
15
-
16
- # Copy requirements file
17
  COPY requirements.txt .
18
 
19
- # Install Python dependencies
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # Copy only the necessary files
23
- COPY app.py /code/app.py
24
-
25
- # Make port 7860 available to the world outside this container
26
  EXPOSE 7860
27
 
28
- # Run the application using gunicorn
29
- CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
 
1
+ # Use an official Python image as a base
2
+ FROM python:3.9
3
 
4
+ # Set the working directory
5
+ WORKDIR /app
 
6
 
7
+ # Copy the current directory contents into the container at /app
8
+ COPY . /app
9
 
10
+ # Copy the requirements file into the container
 
 
 
 
 
11
  COPY requirements.txt .
12
 
13
+ # Install dependencies from requirements.txt
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Expose the port Hypercorn will run on (Hugging Face typically uses 7860)
 
 
 
17
  EXPOSE 7860
18
 
19
+ # Run the app with Hypercorn
20
+ CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860"]
21
+