-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add production version of API serving (#547)
- Loading branch information
Showing
6 changed files
with
283 additions
and
166 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
########### | ||
# BUILDER # | ||
########### | ||
|
||
FROM python:3.11.6-slim-bullseye AS builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install dependencies | ||
COPY ./setup.py setup.py | ||
COPY ./cornac cornac | ||
COPY ./README.md README.md | ||
|
||
RUN pip install --upgrade pip | ||
RUN pip install Cython numpy scipy | ||
|
||
RUN apt-get update && \ | ||
apt-get -y --no-install-recommends install gcc g++ | ||
|
||
RUN pip install --no-cache-dir . # install cornac | ||
|
||
########## | ||
# RUNNER # | ||
########## | ||
|
||
FROM python:3.11.6-slim-bullseye AS runner | ||
|
||
WORKDIR /app | ||
|
||
# Set environment variables | ||
ENV MODEL_PATH="" | ||
ENV MODEL_CLASS="" | ||
ENV PORT=5000 | ||
|
||
COPY --from=builder /app/cornac cornac | ||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
|
||
RUN apt-get update && \ | ||
apt-get -y --no-install-recommends install gcc g++ && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip install --no-cache-dir Flask gunicorn | ||
|
||
WORKDIR /app/cornac/serving | ||
|
||
CMD ["gunicorn", "app:app"] |
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
This file was deleted.
Oops, something went wrong.
Empty file.
Oops, something went wrong.