-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
73 lines (59 loc) · 1.57 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
66
67
68
69
70
71
72
73
# Builder
FROM usgsastro/debian:8
ENV PIP_CERT /etc/ssl/certs/ca-certificates.crt
ENV REQUESTS_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
apt-get install -y \
gfortran \
libffi-dev \
libgeos-dev \
libjpeg-dev \
liblapack-dev \
libopenjp2-7-dev \
libopenblas-dev \
libpq-dev \
libtiff-dev \
libzip-dev \
proj-bin \
python \
python-dev \
python-pip \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*
RUN useradd -m appuser
WORKDIR /home/appuser
COPY . app
RUN chown -R appuser:appuser app
WORKDIR app
USER appuser
ENV PATH "/home/appuser/.local/bin:$PATH"
RUN pip install --user -U pip 'setuptools<45' && \
pip install --user Cython cffi==1.3.0 virtualenv 'zipp<2' && \
virtualenv .env
RUN source .env/bin/activate && \
pip install -r requirements.txt
# Runner
FROM usgsastro/debian:8
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
apt-get install -y \
libffi6 \
libgeos-c1 \
libjpeg62 \
liblapack3 \
libopenjp2-7 \
libopenblas-base \
libpq5 \
libtiff5 \
libzip2 \
proj-bin \
python \
python-pip \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*
RUN useradd -m appuser
USER appuser
COPY --from=0 /home/appuser/app /home/appuser/app
WORKDIR /home/appuser/app/croplands-api
ENV PATH="/home/appuser/app/.env/bin:$PATH"
EXPOSE 8000
CMD gunicorn herokuapp:app -b :8000 --workers=2 -k gevent -t 45 --log-level=DEBUG