Skip to content

Commit b1ed0e1

Browse files
committed
changes done in Dockerfile
1 parent e1deb2e commit b1ed0e1

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

Dockerfile

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

53
WORKDIR /app
64

7-
COPY flask_app/requirements.txt /app/
8-
9-
#install only neccessary libraries
10-
RUN pip install --no-cache-dir -r requirements.txt
11-
125
COPY flask_app/ /app/
13-
COPY models/vectorizer.pkl /app/models/vectorizer.pkl
14-
15-
RUN python -m nltk.downloader stopwords wordnet
166

17-
#--------------------------------------------------------------------------------------------
18-
19-
FROM python:3.10-slim AS final
20-
21-
WORKDIR /app
7+
COPY models/vectorizer.pkl /app/models/vectorizer.pkl
228

23-
#copy only neccesary files from the build stage
24-
COPY --from=build /app /app
9+
RUN pip install -r requirements.txt
2510

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

2813
EXPOSE 5000
2914

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

flask_app/app.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# updated app.py
2-
31
from flask import Flask, render_template,request
42
import mlflow
53
import pickle
64
import os
75
import pandas as pd
86
import numpy as np
97
import re
10-
import nltk
118
import string
129
from nltk.corpus import stopwords
1310
from nltk.stem import WordNetLemmatizer

0 commit comments

Comments
 (0)