Skip to content

Commit

Permalink
changes done in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
2003HARSH committed Nov 11, 2024
1 parent e1deb2e commit b1ed0e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
25 changes: 5 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
#multistage build to reduce image size

FROM python:3.10 AS build
FROM python:3.10-slim

WORKDIR /app

COPY flask_app/requirements.txt /app/

#install only neccessary libraries
RUN pip install --no-cache-dir -r requirements.txt

COPY flask_app/ /app/
COPY models/vectorizer.pkl /app/models/vectorizer.pkl

RUN python -m nltk.downloader stopwords wordnet

#--------------------------------------------------------------------------------------------

FROM python:3.10-slim AS final

WORKDIR /app
COPY models/vectorizer.pkl /app/models/vectorizer.pkl

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

RUN pip install gunicorn
RUN python -m nltk.downloader stopwords wordnet

EXPOSE 5000

CMD ["gunicorn","--bind","0.0.0.0:5000","--timeout","120","app:app"]
CMD ["python","app.py"]
3 changes: 0 additions & 3 deletions flask_app/app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# updated app.py

from flask import Flask, render_template,request
import mlflow
import pickle
import os
import pandas as pd
import numpy as np
import re
import nltk
import string
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
Expand Down

0 comments on commit b1ed0e1

Please sign in to comment.