# Base layer (miniconda comes packed with a Debian-based Linux, py3 and conda)
FROM continuumio/miniconda3

# Label creator details
LABEL name="Jonathan S. Davies"
LABEL email="jonathan.davies1605@gmail.com"

# Create a volume on the local machine
VOLUME [ "/nn-volume" ]

# Set the working director to the following
WORKDIR /nn-data

# Create the environment:
COPY . /nn-data

# Create an Anaconda environment from the provided YAML file
RUN conda env create -f environment.yml

# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "tf-py", "/bin/bash", "-c"]

# Demonstrate the environment is activated:
RUN echo "Install ML-related packages:"
RUN conda install -c anaconda keras=2.6.0 -y
RUN conda install -c anaconda keras-preprocessing=1.1.2 -y
RUN conda install -c anaconda pillow -y
RUN conda install -c anaconda numpy -y
RUN pip install opencv-contrib-python-headless

# The code to run when container is started:
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "tf-py", "python"]