omm7 commited on
Commit
be5cc7a
·
verified ·
1 Parent(s): 57f80b9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -17
Dockerfile CHANGED
@@ -1,25 +1,16 @@
1
- # Use a minimal base image with Python 3.9 installed
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory inside the container to /app
5
  WORKDIR /app
6
 
7
- # Copy the requirements file first to leverage Docker's layer caching
8
- # This layer only rebuilds if requirements.txt is modified
9
- COPY requirements.txt /app/requirements.txt
10
-
11
- # Install Python dependencies
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Copy the rest of the backend files
15
- # This layer rebuilds on app.py changes, but the pip install step remains cached
16
- COPY app.py /app/
17
- COPY boston_housing_model.pkl /app/
18
- COPY preprocessor.pkl /app/
19
-
20
- # Expose port 5000 for the Flask application
21
- EXPOSE 5000
22
 
23
- # Define the command to run the Flask application using Gunicorn
24
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
25
 
 
 
 
 
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
+ COPY requirements.txt .
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
+ COPY app.py .
9
+ COPY boston_housing_model.pkl .
10
+ COPY preprocessor.pkl .
 
 
 
 
 
11
 
12
+ # Expose the port Hugging Face provides
13
+ EXPOSE ${PORT}
14
 
15
+ # Use the PORT environment variable
16
+ CMD exec gunicorn --bind 0.0.0.0:${PORT} app:app