Skip to content

Commit e1deb2e

Browse files
committed
Resolved bugs in Dockerfile
1 parent c507738 commit e1deb2e

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

Dockerfile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
FROM python:3.10-slim
1+
#multistage build to reduce image size
2+
3+
FROM python:3.10 AS build
24

35
WORKDIR /app
46

5-
COPY flask_app/ /app/
7+
COPY flask_app/requirements.txt /app/
8+
9+
#install only neccessary libraries
10+
RUN pip install --no-cache-dir -r requirements.txt
611

12+
COPY flask_app/ /app/
713
COPY models/vectorizer.pkl /app/models/vectorizer.pkl
814

9-
RUN pip install -r requirements.txt
15+
RUN python -m nltk.downloader stopwords wordnet
16+
17+
#--------------------------------------------------------------------------------------------
18+
19+
FROM python:3.10-slim AS final
20+
21+
WORKDIR /app
22+
23+
#copy only neccesary files from the build stage
24+
COPY --from=build /app /app
1025

11-
RUN python -m nltk.downloader stopwords wordnet
26+
RUN pip install gunicorn
1227

1328
EXPOSE 5000
1429

15-
CMD ["python","app.py"]
30+
CMD ["gunicorn","--bind","0.0.0.0:5000","--timeout","120","app:app"]

flask_app/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
gunicorn
12
Flask==3.0.3
23
mlflow==2.15.1
34
mlflow_skinny==2.15.1

0 commit comments

Comments
 (0)