# Get Debian Linux OS docker base file
FROM continuumio/miniconda3

# Set the working directory to /app
WORKDIR /app

# Install mamba—speeds up conda
RUN conda install mamba -n base -c conda-forge

# Copy over env file
COPY mtcenv.yml /app

# create conda envt from YML file (using mamba for speed)
RUN mamba env create -f mtcenv.yml

# enable conda command in bash terminal - though this is only needed if the batch command includes conda (which it typically won't)
RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> /root/.bashrc

# Make sure the Python in our newly created env is the first one on the path, so python3 picks it up
ENV PATH /opt/conda/envs/mtcenv/bin:$PATH 

RUN conda list

# Download required models for text packages
RUN python3 -m spacy download en_core_web_sm
RUN python3 -m nltk.downloader punkt
RUN python3 -m nltk.downloader vader_lexicon
RUN python3 -m nltk.downloader stopwords

# download AzCopy, unzip and add to path
RUN wget -O azcopy.tar.gz https://aka.ms/downloadazcopy-v10-linux

RUN tar -xf azcopy.tar.gz && rm -f azcopy.tar.gz 

RUN cp ./azcopy_linux_amd64_*/azcopy /usr/bin/

# Changed from CMD as CMD ends session (can use VS code to connect to live session)
RUN azcopy --version

# Copy the current directory contents into the container at /app
COPY . /app