Skip to content

Commit

Permalink
Add docker files to test with gdal34 and gdal36
Browse files Browse the repository at this point in the history
  • Loading branch information
margrietpalm committed Feb 20, 2024
1 parent cd4f74e commit fb28fea
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Dockerfile_gdal34
Original file line number Diff line number Diff line change
@@ -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.*

58 changes: 58 additions & 0 deletions Dockerfile_gdal36
Original file line number Diff line number Diff line change
@@ -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"]

34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fb28fea

Please sign in to comment.