Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleDockerfile
FROM ubuntu:18.04

# set these variables related to miniconda

ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN apt-get update

RUN apt-get install -y wget && rm -rf /var/lib/apt/lists/*

# install latest miniconda

RUN wget \
    https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Miniconda3-latest-Linux-x86_64.sh -b \
    && rm -f Miniconda3-latest-Linux-x86_64.sh

RUN conda --version

RUN conda clean -a

RUN echo $CONDA_PREFIX

# below are extractor related commands

COPY extractor_info.json .


COPY aux_data ./aux_data

COPY config ./config

COPY landsattrend ./landsattrend

COPY models ./models

# conda related - copy the yml file for the environment

COPY environment_py38_v2_extractor.yml environment_py38_v2_extractor.yml

COPY extractor_info.json extractor_info.json

COPY lake_analysis.py lake_analysis.py

COPY test.py test.py

COPY lake_analysis_extractor.py lake_analysis_extractor.py

COPY requirements.txt requirements.txt

COPY setup.py setup.py

RUN ls

# mamba is much faster with solving the dependencies in yml files
# using conda can be incredibly slow

RUN conda install -c conda-forge mamba

# use mamba instead of conda to install environment from yml file

RUN mamba env create -f environment_py38_v2_extractor.yml

# the line below is necessary to make sure that the python used is the python associated
# with the conda environment

SHELL ["conda", "run", "-n", "landsattrend2", "/bin/bash", "-c"]

RUN python -m pip install --ignore-installed pyclowder

# make sure to include commands "conda" "run" to use the conda environment, instead of default python

CMD ["conda", "run", "--no-capture-output", "-n", "landsattrend2", "python","-u", "/lake_analysis_extractor.py"]


Here is the related part of the yml file:

Code Block
languagebash
titleyml
name: landsattrend2
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.8
  - gdal=3.3.2