-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (61 loc) · 1.81 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
# base - install common dependencies & create directories
FROM python:2.7-alpine3.8 as base
RUN set -eux \
&& apk add --no-cache \
# TODO get rid of bash after updating all scripts
bash \
build-base \
curl \
git \
libffi-dev \
linux-headers \
openssl-dev \
py-pip \
python-dev \
su-exec \
&& pip install --upgrade \
pip \
setuptools \
wheel \
gunicorn[gevent] \
&& mkdir -p \
# TODO simplify/unify structure:
/var/scitran/data \
/var/scitran/keys \
/var/scitran/logs
COPY requirements.txt /src/requirements.txt
RUN pip install -r /src/requirements.txt
EXPOSE 8080
VOLUME /var/scitran/data
VOLUME /var/scitran/keys
VOLUME /var/scitran/logs
WORKDIR /src/core
ENV SCITRAN_PERSISTENT_DATA_PATH=/var/scitran/data
COPY docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["gunicorn", "--reload", "-c" "/src/core/gunicorn_config.py", "api.app"]
# dist - install requirements & core
FROM base as dist
COPY . /src/core
RUN pip install --no-deps -e /src/core
ARG API_VERSION=''
ARG VCS_BRANCH=NULL
ARG VCS_COMMIT=NULL
RUN set -eux \
&& echo $API_VERSION > /src/core/api_version.txt \
&& /src/core/bin/build_info.sh $VCS_BRANCH $VCS_COMMIT > /src/core/version.json \
&& cat /src/core/version.json
# testing - install mongodb & test deps for standalone running/testing
FROM base as testing
RUN set -eux \
&& apk add --no-cache mongodb \
&& mkdir -p /data/db
VOLUME /data/db
EXPOSE 27017
COPY tests/requirements.txt /src/core/tests/requirements.txt
RUN pip install -r /src/core/tests/requirements.txt
COPY . /src/core
RUN pip install --no-deps -e /src/core
# TODO uncomment once compatible with fly/fly
# # make dist the last (default) build target
# FROM dist