forked from kserve/models-web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (46 loc) · 1.68 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# --- Clone the kubeflow/kubeflow code ---
FROM ubuntu AS fetch-kubeflow-kubeflow
RUN apt-get update && apt-get install git -y
WORKDIR /kf
COPY ./frontend/COMMIT ./
RUN git clone https://github.com/kubeflow/kubeflow.git && \
COMMIT=$(cat ./COMMIT) && \
cd kubeflow && \
git checkout $COMMIT
# --- Build the backend kubeflow-wheel ---
FROM python:3.7-slim AS backend-kubeflow-wheel
WORKDIR /src
ARG BACKEND_LIB=/kf/kubeflow/components/crud-web-apps/common/backend
COPY --from=fetch-kubeflow-kubeflow $BACKEND_LIB .
RUN python setup.py sdist bdist_wheel
# --- Build the frontend kubeflow library ---
FROM node:12-buster-slim AS frontend-kubeflow-lib
WORKDIR /src
ARG LIB=/kf/kubeflow/components/crud-web-apps/common/frontend/kubeflow-common-lib
COPY --from=fetch-kubeflow-kubeflow $LIB/package*.json ./
RUN npm install
COPY --from=fetch-kubeflow-kubeflow $LIB/ ./
RUN npm run build
# --- Build the frontend ---
FROM node:12-buster-slim AS frontend
WORKDIR /src
COPY ./frontend/package*.json ./
RUN npm install
COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
COPY ./frontend/ .
RUN npm run build -- --output-path=./dist/default --configuration=production
# Web App
FROM python:3.7-slim
WORKDIR /package
COPY --from=backend-kubeflow-wheel /src/dist .
RUN pip3 install *.whl
WORKDIR /src
COPY ./backend/requirements.txt .
RUN pip3 install -r requirements.txt
COPY ./backend/apps/ ./apps
COPY ./backend/entrypoint.py .
COPY ./backend/Makefile .
COPY --from=frontend /src/dist/default/ /src/apps/v1beta1/static/
ENV APP_PREFIX /models
ENV APP_VERSION v1beta1
ENTRYPOINT ["gunicorn", "-w", "3", "--bind", "0.0.0.0:5000", "--access-logfile", "-", "entrypoint:app"]