Skip to content

Commit

Permalink
DAS-2180: Remove Conda dependency on docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
flamingbear committed Jun 18, 2024
1 parent d9bf66a commit 5d5b225
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 34 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ also with units of degrees.
|- CONTRIBUTING.md
|- LICENSE
|- README.md
|- conda_requirements.txt
|- dev-requirements.txt
|- legacy-CHANGELOG.md
|- pip_requirements.txt
Expand Down Expand Up @@ -173,9 +172,6 @@ also with units of degrees.

* `README.md` - This file, containing guidance on developing the service.

* `conda_requirements.txt` - A list of service dependencies, such as GDAL, that
cannot be installed via Pip.

* `dev-requirements.txt` - list of packages required for service development.

* `legacy-CHANGELOG.md` - Notes for each version that was previously released
Expand All @@ -193,12 +189,11 @@ regarding creation of a local Harmony instance.

If testing small functions locally that do not require inputs from the main
Harmony application, it is recommended that you create a Python virtual
environment via conda, and then install the necessary dependencies for the
environment, and then install the necessary dependencies for the
service within that environment via conda and pip then install the pre-commit hooks.

```
> conda create --name hybig-env python==3.11
> conda install --file conda_requirements.txt
> pip install -r pip_requirements.txt
> pip install -r dev-requirements.txt
Expand Down
1 change: 0 additions & 1 deletion conda_requirements.txt

This file was deleted.

33 changes: 7 additions & 26 deletions docker/service.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,28 @@
# 2023-01-26: Updated for the Harmony Regridding Service.
# 2023-04-04: Updated for HyBIG.
# 2023-04-23: Updated conda clean and pip install to keep Docker image slim.
# 2024-06-18: Updates to remove conda dependency.
#
###############################################################################
FROM continuumio/miniconda3
FROM python:3.11

WORKDIR "/home"

# Create Conda environment:
COPY conda_requirements.txt conda_requirements.txt
RUN conda create --yes --name hybig --file conda_requirements.txt \
python=3.11 --channel conda-forge --channel defaults -q && \
conda clean --all --force-pkgs-dirs --yes
RUN apt-get update
RUN apt-get install -y libgdal-dev

# Install additional Pip dependencies
# Install Pip dependencies
COPY pip_requirements.txt pip_requirements.txt
RUN conda run --name hybig pip install --no-input --no-cache-dir \
RUN pip install --no-input --no-cache-dir \
-r pip_requirements.txt

# Copy service code.
COPY ./harmony_browse_image_generator harmony_browse_image_generator

# Set conda environment for HyBIG, as `conda run` will not stream logging.
# Setting these environment variables is the equivalent of `conda activate`.
ENV _CE_CONDA='' \
_CE_M='' \
CONDA_DEFAULT_ENV=hybig \
CONDA_EXE=/opt/conda/bin/conda \
CONDA_PREFIX=/opt/conda/envs/hybig \
CONDA_PREFIX_1=/opt/conda \
CONDA_PROMPT_MODIFIER=(hybig) \
CONDA_PYTHON_EXE=/opt/conda/hybig/python \
CONDA_ROOT=/opt/conda \
CONDA_SHLVL=2 \
PATH="/opt/conda/envs/hybig/bin:${PATH}" \
SHLVL=1

# Set GDAL related environment variables.
ENV CPL_ZIP_ENCODING=UTF-8 \
GDAL_DATA=/opt/conda/envs/hybig/share/gdal \
GSETTINGS_SCHEMA_DIR=/opt/conda/envs/hybig/share/glib-2.0/schemas \
GSETTINGS_SCHEMA_DIR_CONDA_BACKUP='' \
PROJ_LIB=/opt/conda/envs/hybig/share/proj
GDAL_DATA=/usr/share/gdal

# Configure a container to be executable via the `docker run` command.
ENTRYPOINT ["python", "-m", "harmony_browse_image_generator"]
4 changes: 3 additions & 1 deletion docker/tests.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
# 2023-04-04: Updated for HyBIG.
# 2023-04-17: Added --no-cache-dir to keep Docker images slim.
# 2024-01-22: Updated to use new open-source service image name.
# 2024-06-18: Removes Conda.
#
###############################################################################
FROM ghcr.io/nasa/harmony-browse-image-generator

# Install additional Pip requirements (for testing)
COPY tests/pip_test_requirements.txt .
RUN conda run --name hybig pip install --no-input --no-cache-dir \

RUN pip install --no-input --no-cache-dir \
-r pip_test_requirements.txt

# Copy test directory containing Python unittest suite, test data and utilities
Expand Down
1 change: 1 addition & 0 deletions pip_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ rioxarray==0.15.5
numpy==1.26.4
pillow==10.3.0
pyproj==3.6.1
GDAL==3.6.2

0 comments on commit 5d5b225

Please sign in to comment.