Merge pull request #1955 from phargogh/bugfix/1952-container-builds-failing-to-find-libgdal
Defining the GDAL version used in the debian install.
This commit is contained in:
commit
df5a781e6b
|
@ -2,6 +2,7 @@ name: Build containers
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'docker/*'
|
- 'docker/*'
|
||||||
|
@ -39,6 +40,8 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: login to GitHub Container Registry
|
- name: login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
|
@ -55,9 +58,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# Replace / (invalid tag character) with .
|
# Replace / (invalid tag character) with .
|
||||||
SANITIZED_REF="$(echo ${{github.ref_name}} | sed 's|/|.|g')"
|
SANITIZED_REF="$(echo ${{github.ref_name}} | sed 's|/|.|g')"
|
||||||
cd docker && docker build \
|
docker build -f docker/Dockerfile \
|
||||||
--build-arg="INVEST_REPO=${{ github.repository }}" \
|
|
||||||
--build-arg="INVEST_VERSION=${{ github.sha }}" \
|
|
||||||
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest \
|
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest \
|
||||||
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
|
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ github.sha }} \
|
||||||
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${SANITIZED_REF} \
|
-t ghcr.io/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${SANITIZED_REF} \
|
||||||
|
|
|
@ -1,26 +1,33 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
# Build the InVEST wheel in a separate container stage
|
# Build the InVEST wheel in a separate container stage
|
||||||
FROM debian:12.2 AS build
|
FROM debian:12.11 AS build
|
||||||
ARG INVEST_VERSION="main"
|
|
||||||
ARG INVEST_REPO="natcap/invest"
|
|
||||||
RUN apt update && apt install -y python3 python3-dev python3-pip python3-build build-essential git python3.11-venv libgdal-dev
|
RUN apt update && apt install -y python3 python3-dev python3-pip python3-build build-essential git python3.11-venv libgdal-dev
|
||||||
RUN cd / && \
|
|
||||||
git clone https://github.com/${INVEST_REPO}.git && \
|
# only copy in the files needed for building the wheel
|
||||||
cd $(basename ${INVEST_REPO}) && \
|
ADD src /invest/src
|
||||||
git checkout ${INVEST_VERSION} && \
|
ADD pyproject.toml /invest/pyproject.toml
|
||||||
python3 -m build
|
ADD setup.py /invest/setup.py
|
||||||
|
ADD requirements.txt /invest/requirements.txt
|
||||||
|
ADD .git /invest/.git
|
||||||
|
RUN cd /invest && python3 -m build
|
||||||
|
|
||||||
# Create the container for distribution that has runtime dependencies.
|
# Create the container for distribution that has runtime dependencies.
|
||||||
FROM mambaorg/micromamba:1.5.0-bookworm-slim
|
FROM mambaorg/micromamba:2.1.1-debian12-slim
|
||||||
# Python version should match the version used in stage 1.
|
# Python version should match the version used in stage 1.
|
||||||
# If we update the stage 1 debian version, also update this python version
|
# If we update the stage 1 debian version, also update this python version
|
||||||
ARG PYTHON_VERSION="3.11"
|
ARG PYTHON_VERSION="3.11"
|
||||||
COPY --from=build /invest/dist/*.whl /tmp/
|
COPY --from=build /invest/dist/*.whl /tmp/
|
||||||
|
|
||||||
|
|
||||||
|
# Define this to be the GDAL version used to build the InVEST wheel in the debian step.
|
||||||
|
# Check the debian package repo for the debian release above to confirm the version.
|
||||||
|
# Debian's GDAL version will undoubtedly be earlier than what's available in conda-forge.
|
||||||
|
ARG DEBIAN_GDAL_VERSION="3.6"
|
||||||
|
|
||||||
# The environment.yml file will be built during github actions.
|
# The environment.yml file will be built during github actions.
|
||||||
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml
|
COPY --chown=$MAMBA_USER:$MAMBA_USER docker/environment.yml /tmp/environment.yml
|
||||||
RUN micromamba install -y -n base -c conda-forge python==${PYTHON_VERSION} && \
|
RUN micromamba install -y -n base -c conda-forge python==${PYTHON_VERSION} gdal=${DEBIAN_GDAL_VERSION} && \
|
||||||
micromamba install -y -n base -c conda-forge -f /tmp/environment.yml && \
|
micromamba install -y -n base -c conda-forge -f /tmp/environment.yml && \
|
||||||
micromamba clean --all --yes && \
|
micromamba clean --all --yes && \
|
||||||
/opt/conda/bin/python -m pip install /tmp/*.whl && \
|
/opt/conda/bin/python -m pip install /tmp/*.whl && \
|
||||||
|
|
Loading…
Reference in New Issue