DeepActionPotential commited on
Commit
24ed131
·
verified ·
1 Parent(s): e0f2d0e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -19
Dockerfile CHANGED
@@ -1,19 +1,23 @@
1
- # 1. Use a base Python image
2
- FROM python:3.10-slim
3
-
4
- # 2. Set the working directory inside the container
5
- WORKDIR /app
6
-
7
- # 3. Copy the dependencies file and install them
8
- COPY requirements.txt .
9
- RUN pip install --no-cache-dir -r requirements.txt
10
-
11
- # 4. Copy the rest of your application code
12
- COPY . .
13
-
14
- # 5. Expose the required port (Hugging Face default)
15
- EXPOSE 7860
16
-
17
- # 6. Start the production server (Gunicorn is highly recommended for production)
18
- # The format is: gunicorn -b <host>:<port> <app_file>:<flask_app_object>
19
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
 
 
 
 
1
+ Use the official Python 3.12 slim image. This version supports
2
+ newer libraries like numpy==2.3.3 which require Python 3.11 or higher.
3
+ FROM python:3.12-slim
4
+
5
+ Set the working directory in the container
6
+ WORKDIR /app
7
+
8
+ Copy the requirements file into the container
9
+ COPY requirements.txt .
10
+
11
+ Install all Python dependencies, using the updated base image
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ Copy the rest of the application code
15
+ COPY . .
16
+
17
+ Install gunicorn, which will be used to run the Flask app
18
+ RUN pip install gunicorn
19
+
20
+ Define the default command to run the application using gunicorn.
21
+ The app:app assumes your Flask app instance is named app inside app.py.
22
+ The port is set to 7860 as required by Hugging Face Spaces.
23
+ CMD exec gunicorn --bind :7860 --workers 1 --threads 8 app:app