-
Notifications
You must be signed in to change notification settings - Fork 57
/
Dockerfile.webui
37 lines (29 loc) · 1.28 KB
/
Dockerfile.webui
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
FROM python:3.7-slim-stretch
WORKDIR /var/task
RUN pip install --upgrade pip virtualenv gunicorn
RUN mkdir -p ./snowalert
RUN virtualenv ./snowalert/venv
ENV PATH="/var/task/snowalert/venv/bin:${PATH}"
COPY ./src ./snowalert/src
# backend
RUN apt-get update \
&& apt-get install -y gcc linux-libc-dev r-base \
&& rm -rf /var/lib/apt/lists/* \
&& PYTHONPATH='' pip install ./snowalert/src/ ./snowalert/src/webui/backend/ \
&& apt-get purge -y --auto-remove gcc linux-libc-dev
# frontend
RUN apt-get update \
&& apt-get install -y curl gnupg2 apt-transport-https \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn \
&& cd ./snowalert/src/webui/frontend && yarn install && yarn build \
&& rm -fr node_modules \
&& apt-get purge -y --auto-remove curl gnupg2 apt-transport-https nodejs yarn
# link frontend build into backend venv
RUN ln -s $PWD/snowalert/src/webui/frontend ./snowalert/venv/lib/python3.7/
WORKDIR /var/task/snowalert/src/webui/backend/
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--access-logfile=-", "webui.app:app"]