# This is meant to turn a conda environment.yml file into a container. To be used like:
# docker build -t image_name:tag --build-arg ENV_FILE=myenv.yml --build-arg CONDA_IMAGE=continuumio/miniconda3 -f src/meadowrun/docker_files/CondaDockerfile .
# This assumes that ./myenv.yml exists and defines the environment

ARG CONDA_IMAGE

FROM $CONDA_IMAGE

ENV PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

WORKDIR /tmp/

ARG ENV_FILE

COPY $ENV_FILE ./
# we would rather not assume that the name of the environment in $ENV_NAME.yml is the
# same as the filename, so we just hardcode a name here
RUN conda env create -f $ENV_FILE -n the_env
ENV PATH /opt/conda/envs/the_env/bin:$PATH
