forked from pinterest/querybook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (42 loc) · 1.72 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
FROM python:3.7.9
ARG PRODUCTION=true
## Install Querybook package requirements + NodeJS
# Installing build-essential and python-dev for uwsgi
RUN rm -rf /var/lib/apt/lists/* \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
libsasl2-dev \
libsasl2-modules \
build-essential \
python-dev \
libssl-dev \
libldap2-dev \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
nodejs \
&& apt-get clean
# Install YARN
RUN npm i -g [email protected] \
&& npm i -g yarn@^1.22 \
&& npm explore npm --global -- npm install [email protected] \
&& yarn config set cache-folder /mnt/yarn-cache/cache \
&& yarn config set yarn-offline-mirror /mnt/yarn-offline-mirror
WORKDIR /opt/querybook
COPY requirements requirements/
RUN pip install -r requirements/base.txt \
&& if [ "${PRODUCTION}" = "true" ] ; then \
pip install -r requirements/prod.txt; \
else \
pip install -r requirements/dev.txt; \
fi \
&& pip install -r requirements/local.txt || true
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --pure-lockfile && npm rebuild node-sass
# Copy everything else
COPY . .
# Webpack if prod
RUN if [ "${PRODUCTION}" = "true" ] ; then ./node_modules/.bin/webpack --mode=production; fi
# Environment variables, override plugins path for customization
ENV QUERYBOOK_PLUGIN=/opt/querybook/plugins
ENV PYTHONPATH=/opt/querybook/querybook/server:/opt/querybook/plugins
ENV production=${PRODUCTION}