forked from blueraster/poly-intersect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
53 lines (42 loc) · 1.71 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
###############################################################
# This is a Conda/Python 3.6/GDAL build based on:
# https://hub.docker.com/r/conda/miniconda3/~/dockerfile/
###############################################################
FROM debian:jessie-slim
MAINTAINER David Eitelberg, [email protected]
ENV NAME polyIntersect
ENV USER polyIntersect
RUN apt-get -qq update && apt-get -qq -y install curl bzip2 \
&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -bfp /usr/local \
&& rm -rf /tmp/miniconda.sh \
&& apt-get -qq -y remove curl bzip2 \
&& apt-get -qq -y autoremove \
&& apt-get autoclean \
&& rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
&& conda clean --all --yes
RUN mkdir -p /opt/$NAME
COPY environment-ubuntu.yml /opt/$NAME/environment.yml
ENV PATH /usr/local/envs/gfw-api/bin:$PATH
RUN groupadd $USER && useradd -g $USER $USER -s /bin/bash
RUN conda update conda
RUN conda config --add channels conda-forge
RUN conda config --set always_yes yes --set changeps1 no
RUN cd /opt/$NAME && conda env create -f environment.yml
COPY entrypoint.sh /opt/$NAME/entrypoint.sh
COPY main.py /opt/$NAME/main.py
COPY gunicorn.py /opt/$NAME/gunicorn.py
# Copy the application folder inside the container
WORKDIR /opt/$NAME
COPY ./$NAME /opt/$NAME/$NAME
COPY ./microservice /opt/$NAME/microservice
COPY ./tests /opt/$NAME/tests
RUN chown -R $USER:$USER /opt/$NAME
# Tell Docker we are going to use this ports
EXPOSE 5700
USER $USER
# Run unit tests
ENTRYPOINT ["/bin/bash", "-c"]
RUN ["/bin/bash", "-c", "source activate gfw-api && exec pytest -v && source deactivate"]
# Launch script
ENTRYPOINT ["./entrypoint.sh"]