From 7fcc6a62b1762fda0494285d42f39d7ddcb88e5d Mon Sep 17 00:00:00 2001 From: Carlos Paniagua Date: Sat, 17 Feb 2024 02:19:10 -0500 Subject: [PATCH 1/3] Update Dockerfile to use Python 3.11 image and install required packages --- Dockerfile | 60 ++++++++++++++++-------------------------------------- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd0de0d7..466445eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,22 @@ -# Using the ubuntu:20.04 base image for compatibility with the ICESat-2 SlideRule software -# Some code to add conda from https://github.com/conda-forge/miniforge-images/blob/master/ubuntu/Dockerfile -# This file builds the docker image for the ICESat-2 tracks project. Includes the ICESat-2 SlideRule tool, conda, and the python3.11 environment for the project with dependencies provided in the environment_small.yml file. -FROM ubuntu:20.04 -ARG DEBIAN_FRONTEND=noninteractive -ARG MINIFORGE_NAME=Miniforge3 -ARG MINIFORGE_VERSION=23.3.1-0 -ARG TARGETPLATFORM +# Use the official Python 3.11 image from the Docker Hub +FROM python:3.11 -ENV CONDA_DIR=/opt/conda -ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV PATH=${CONDA_DIR}/bin:${PATH} -ENV ENVNAME=2021-icesat2-tracks -RUN apt-get update && \ - apt-get install -y git curl wget +# Update the system and install the packages +RUN apt-get update && apt-get install -y \ + openmpi-bin \ + openmpi-doc \ + libopenmpi-dev -# Install sliderule dependencies -RUN apt-get install -y build-essential libreadline-dev liblua5.3-dev zlib1g-dev cmake -RUN git clone https://github.com/ICESat2-SlideRule/sliderule.git -WORKDIR /sliderule/ -RUN make config && \ - make && \ - make install +# Set the working directory to /app +WORKDIR /app -# Install conda -RUN apt-get update > /dev/null && \ - apt-get install --no-install-recommends --yes \ - bzip2 ca-certificates \ - tini \ - > /dev/null && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* && \ - wget --no-hsts --quiet https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/${MINIFORGE_NAME}-${MINIFORGE_VERSION}-Linux-$(uname -m).sh -O /tmp/miniforge.sh && \ - /bin/bash /tmp/miniforge.sh -b -p ${CONDA_DIR} && \ - rm /tmp/miniforge.sh && \ - conda clean --tarballs --index-cache --packages --yes && \ - find ${CONDA_DIR} -follow -type f -name '*.a' -delete && \ - find ${CONDA_DIR} -follow -type f -name '*.pyc' -delete && \ - conda clean --force-pkgs-dirs --all --yes && \ - echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> /etc/skel/.bashrc && \ - echo ". ${CONDA_DIR}/etc/profile.d/conda.sh && conda activate base" >> ~/.bashrc +# Copy the current directory contents into the container at /app +COPY . /app -# Install conda environment -COPY environment_small.yml /tmp/environment.yml -RUN mamba env create -f /tmp/environment.yml +# Create the output directory +RUN mkdir -p /app/output -ENTRYPOINT ["tini", "--"] -CMD ["/bin/bash"] +# Install any needed packages specified in pyproject.toml +RUN pip install . + +CMD ["/bin/bash"] \ No newline at end of file From 99fdc59be80320439137a06f9b76d7ead99c108d Mon Sep 17 00:00:00 2001 From: John Gerrard Holland Date: Mon, 4 Mar 2024 22:12:06 +0000 Subject: [PATCH 2/3] add Dockerfile and devcontainer.json arguments to make install work --- .devcontainer/devcontainer.json | 26 ++++++++++++++++++++++++++ Dockerfile | 10 +++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..8d96444e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Existing Dockerfile", + "build": { + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerfile": "../Dockerfile" + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "cat /etc/os-release", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "devcontainer" +} diff --git a/Dockerfile b/Dockerfile index 466445eb..ef57b371 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,15 @@ # Use the official Python 3.11 image from the Docker Hub -FROM python:3.11 +FROM python:3.9 # Update the system and install the packages RUN apt-get update && apt-get install -y \ + git-lfs \ openmpi-bin \ openmpi-doc \ - libopenmpi-dev + libopenmpi-dev \ + gdal-bin \ + libgdal-dev + # Set the working directory to /app WORKDIR /app @@ -17,6 +21,6 @@ COPY . /app RUN mkdir -p /app/output # Install any needed packages specified in pyproject.toml -RUN pip install . +RUN pip install --editable ".[dev]" CMD ["/bin/bash"] \ No newline at end of file From 268377c698c5e5f1662991bc3de9032e9eaa4063 Mon Sep 17 00:00:00 2001 From: John Gerrard Holland Date: Mon, 4 Mar 2024 22:44:45 +0000 Subject: [PATCH 3/3] =?UTF-8?q?add=20GDAL=20and=20LFS=20=E2=80=93=20make?= =?UTF-8?q?=20docker=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile => .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Dockerfile => .devcontainer/Dockerfile (96%) diff --git a/Dockerfile b/.devcontainer/Dockerfile similarity index 96% rename from Dockerfile rename to .devcontainer/Dockerfile index ef57b371..ccff69f5 100644 --- a/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Use the official Python 3.11 image from the Docker Hub -FROM python:3.9 +FROM python:3.11 # Update the system and install the packages RUN apt-get update && apt-get install -y \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8d96444e..43a4a24b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ // Sets the run context to one level up instead of the .devcontainer folder. "context": "..", // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerfile": "../Dockerfile" + "dockerfile": "Dockerfile" } // Features to add to the dev container. More info: https://containers.dev/features.