-
Notifications
You must be signed in to change notification settings - Fork 144
/
Dockerfile
45 lines (32 loc) · 981 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###########
# BUILDER #
###########
FROM python:3.11-slim AS builder
# Set working directory
WORKDIR /app
# Install dependencies
COPY ./setup.py setup.py
COPY ./cornac cornac
COPY ./README.md README.md
RUN apt-get update && \
apt-get -y --no-install-recommends install gcc g++ && \
pip install --no-cache-dir Cython numpy scipy && \
pip install --no-cache-dir .
# RUN pip install --no-cache-dir cornac # install cornac
##########
# RUNNER #
##########
FROM python:3.11-slim AS runner
WORKDIR /app
# Set environment variables
ENV MODEL_PATH=""
ENV MODEL_CLASS=""
ENV PORT=5000
COPY --from=builder /app/cornac/serving cornac/serving
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 libgomp1 && \
rm -rf /var/lib/apt/lists/* && \
pip install --no-cache-dir Flask gunicorn
WORKDIR /app/cornac/serving
CMD ["gunicorn", "app:app"]