From fb28fea709980e7ed0e089c6ca2ec7bfc508c8d4 Mon Sep 17 00:00:00 2001 From: Margriet Palm Date: Tue, 20 Feb 2024 11:53:27 +0100 Subject: [PATCH] Add docker files to test with gdal34 and gdal36 --- Dockerfile_gdal34 | 42 +++++++++++++++++++++++++++++++++ Dockerfile_gdal36 | 58 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 34 +++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 Dockerfile_gdal34 create mode 100644 Dockerfile_gdal36 create mode 100644 docker-compose.yml diff --git a/Dockerfile_gdal34 b/Dockerfile_gdal34 new file mode 100644 index 00000000..58921e27 --- /dev/null +++ b/Dockerfile_gdal34 @@ -0,0 +1,42 @@ +# Use Debian Bookworm as the base image +FROM ubuntu:22.04 + +# Set environment variables +ENV DEBIAN_FRONTEND noninteractive + +# Install system packages using apt +RUN apt-get update && \ + apt-get install --yes \ + --no-install-recommends \ + libgdal-dev \ + sqlite3 \ + libsqlite3-mod-spatialite \ + python3 \ + python3-pip \ + python3-dev \ + build-essential \ + libxml2-dev \ + libxslt1-dev \ + cmake \ + gfortran \ + && rm -rf /var/lib/apt/lists/* + + +# Set GDAL environment variables +ENV CPLUS_INCLUDE_PATH=/usr/include/gdal +ENV C_INCLUDE_PATH=/usr/include/gdal + +# Upgrade pip to the latest version +RUN python3 -m pip install pygdal==3.4.1.* +RUN python3 -m pip install --upgrade pip setuptools==63.* wheel scikit-build numpy==1.24.* cython + +# Set the working directory +WORKDIR /app + +# Copy your application code into the container +COPY . /app + +# Install the local Python package +RUN python3 setup.py develop clean +RUN python3 -m pip install -e .[test,gridadmin] --no-build-isolation pygdal==3.4.1.* + diff --git a/Dockerfile_gdal36 b/Dockerfile_gdal36 new file mode 100644 index 00000000..38874a60 --- /dev/null +++ b/Dockerfile_gdal36 @@ -0,0 +1,58 @@ +# Use Debian Bookworm as the base image +FROM ubuntu:22.04 as build + +# Set environment variables +ENV DEBIAN_FRONTEND noninteractive + +# Install system packages using apt +RUN apt-get update && \ + apt-get install --yes \ + --no-install-recommends \ + sqlite3 \ + libsqlite3-mod-spatialite \ + python3 \ + python3-pip \ + python3-dev \ + build-essential \ + libxml2-dev \ + libxslt1-dev \ + cmake \ + gfortran \ + software-properties-common \ + && rm -rf /var/lib/apt/lists/* + +# Install gnupg and dirmngr +RUN apt-get update && \ + apt-get install -y gnupg dirmngr && \ + rm -rf /var/lib/apt/lists/* + + +RUN add-apt-repository "ppa:ubuntugis/ppa" -y && \ + apt update && \ + apt install -y libgdal-dev \ + && rm -rf /var/lib/apt/lists/* + + +# Set GDAL environment variables +ENV CPLUS_INCLUDE_PATH=/usr/include/gdal +ENV C_INCLUDE_PATH=/usr/include/gdal + +# Upgrade pip to the latest version +RUN python3 -m pip install pygdal==3.6.4.* +RUN python3 -m pip install --upgrade pip setuptools==63.* wheel scikit-build numpy==1.24.* cython + + +FROM build + +# Set the working directory +WORKDIR /app + +# Copy your application code into the container +COPY . /app + +# Install the local Python package +RUN python3 setup.py develop clean +RUN python3 -m pip install -e .[test,gridadmin] --no-build-isolation pygdal==3.6.4.* + +CMD ["python3", "-m", "pytest"] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..07d10b61 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '1' +services: + gdal34-test: + build: + context: . + dockerfile: Dockerfile_gdal34 + image: gdal34 + container_name: gdal34 + entrypoint: pytest + gdal36-test: + build: + context: . + dockerfile: Dockerfile_gdal36 + image: gdal36 + container_name: gdal36 + entrypoint: pytest + gdal34-create-data: + build: + context: . + dockerfile: Dockerfile_gdal34 + image: gdal34 + container_name: gdal34 + volumes: + - ./data:/data + entrypoint: python3 /app/make_data.py /data/gdal34 + gdal36-create-data: + build: + context: . + dockerfile: Dockerfile_gdal36 + image: gdal36 + container_name: gdal36 + volumes: + - ./data:/data + entrypoint: python3 /app/make_data.py /data/gdal36