forked from kobotoolbox/kpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.koboform_base
55 lines (40 loc) · 1.73 KB
/
Dockerfile.koboform_base
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
# vim: syntax=dockerfile:
# Base image to take care of `apt`, `pip`, and `npm` dependencies. Packages are
# stored outside the source directory so it can be overwritten in development scenarios.
FROM qeddockerhub/base-kobos:latest
ENV KPI_SRC_DIR=/srv/src/kpi \
KPI_NODE_PATH=/srv/node_modules \
PIP_DIR=/srv/pip
###############################
# Prepare to install Node 8.x #
###############################
RUN echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodesource.list && \
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
###########################
# Install `apt` packages. #
###########################
COPY ./dependencies/apt_requirements.txt /srv/tmp/base__apt_requirements.txt
RUN apt-get update -qq && \
apt-get install -qq nodejs $(cat /srv/tmp/base__apt_requirements.txt) && \
apt-get -qq --purge autoremove && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
###########################
# Install `pip` packages. #
###########################
WORKDIR ${PIP_DIR}/
RUN pip install --quiet 'pip>=9,<10' && \
pip install --quiet 'pip-tools>=1.11,<2'
COPY ./dependencies/pip/external_services.txt /srv/tmp/base__external_services.txt
RUN pip-sync /srv/tmp/base__external_services.txt 1>/dev/null && \
rm -rf ~/.cache/pip
###########################
# Install `npm` packages. #
###########################
COPY ./package.json ${KPI_SRC_DIR}/
WORKDIR ${KPI_SRC_DIR}/
RUN mkdir -p "${KPI_NODE_PATH}" && \
ln -s "${KPI_NODE_PATH}" "${KPI_SRC_DIR}/node_modules" && \
npm install --quiet && \
npm cache clean --force && \
mv "${KPI_SRC_DIR}/package.json" /srv/tmp/base_package.json
ENV PATH $PATH:${KPI_NODE_PATH}/.bin