-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.two
47 lines (36 loc) · 1.47 KB
/
Dockerfile.two
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
# Reference: https://fmgdata.kinja.com/using-docker-with-conda-environments-1790901398
FROM continuumio/miniconda3
# Set the ENTRYPOINT to use bash
# (this is also where you’d set SHELL,
# if your version of docker supports this)
ENTRYPOINT [ "/bin/bash", "-c" ]
EXPOSE 5000
# Conda supports delegating to pip to install dependencies
# that aren’t available in anaconda or need to be compiled
# for other reasons. In our case, we need psycopg compiled
# with SSL support. These commands install prereqs necessary
# to build psycopg.
RUN apt-get update && apt-get install -y \
libpq-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Use the environment.yml to create the conda environment.
ADD environment.yml /tmp/environment.yml
WORKDIR /tmp
RUN [ "conda", "env", "create" ]
ADD . /code
# Use bash to source our new environment for setting up
# private dependencies—note that /bin/bash is called in
# exec mode directly
#WORKDIR /code/shared
#RUN [ “/bin/bash”, “-c”, “source activate your-environment && python setup.py develop” ]
#WORKDIR /code
#RUN [ “/bin/bash”, “-c”, “source activate your-environment && python setup.py develop” ]
WORKDIR /code
RUN [ "/bin/bash", "-c", "source activate myenv" ]
# We set ENTRYPOINT, so while we still use exec mode, we don’t
# explicitly call /bin/bash
CMD [ "source activate myenv && exec python run.py" ]
# Final Commands to execute on terminal
# sudo docker build -t condatest .
# sudo docker run condatest