Pamudu13 commited on
Commit
6c4b041
·
verified ·
1 Parent(s): 1685d81

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -16
Dockerfile CHANGED
@@ -1,26 +1,32 @@
1
- # Use an official Python image as a base
2
  FROM python:3.9-slim
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 Flask will run on (Flask default is 5000)
17
- EXPOSE 5000
 
 
 
18
 
19
- # Set the environment variable for Flask
20
- ENV FLASK_APP=app.py
21
- ENV FLASK_RUN_HOST=0.0.0.0
22
- ENV FLASK_RUN_PORT=5000
23
 
24
- # Hugging Face requires `flask` to run with specific configurations:
25
- # To run Flask via HuggingFace, you'll need `gunicorn` to be used as below:
26
- CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
 
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 the application code
23
+ COPY . .
24
+
25
+ # Rename app1.py to app.py since that's more standard
26
+ RUN mv app1.py app.py
27
 
28
+ # Make port 7860 available to the world outside this container
29
+ EXPOSE 7860
 
 
30
 
31
+ # Run the application using gunicorn
32
+ CMD gunicorn --bind 0.0.0.0:7860 app:app