-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
5 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters