diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index f470915..6d18df5 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -5,7 +5,12 @@ on: branches: [develop, main] tags: - 'v*' - + workflow_dispatch: + inputs: + GDAL_VER: + description: "GDAL version to use for Docker build" + required: false + default: "3.12.1" jobs: # ------------------------------------------------------------ # Resolve release tag from ref @@ -77,7 +82,15 @@ jobs: } EOF fi - + - name: Resolve GDAL version + id: gdal + run: | + if [[ -n "${{ github.event.inputs.GDAL_VER }}" ]]; then + GDAL_VER="${{ github.event.inputs.GDAL_VER }}" + else + GDAL_VER="3.12.1" + fi + echo "GDAL_VER=${GDAL_VER}" >> $GITHUB_ENV - name: Build image with Kaniko (to tar) uses: docker://gcr.io/kaniko-project/executor:debug env: @@ -86,6 +99,7 @@ jobs: args: > --context . --dockerfile Dockerfile + --build-arg GDAL_VER=${{ env.GDAL_VER }} --no-push --tar-path image.tar diff --git a/Dockerfile b/Dockerfile index a6ce1bd..c3f0963 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,8 +24,8 @@ RUN apt-get update && apt-get install -y \ tree \ podman \ skopeo \ - && apt-get remove -y yq \ - && rm -rf /var/lib/apt/lists/* + && apt-get remove -y yq && \ + rm -rf /var/lib/apt/lists/* # ------------------------------------------------------------------- # Create user @@ -113,6 +113,34 @@ RUN curl -fsSL \ dpkg -i /tmp/trivy.deb && \ rm /tmp/trivy.deb +#gdal +ARG GDAL_VER=3.12.1 +# fetch, build, install +RUN apt-get update && apt-get install -qy \ + cmake ninja-build libproj-dev proj-data proj-bin; \ + set -e; \ + cd /tmp; \ + curl -fsSL -o gdal-${GDAL_VER}.tar.xz https://download.osgeo.org/gdal/${GDAL_VER}/gdal-${GDAL_VER}.tar.xz \ + || curl -fsSL -o gdal-${GDAL_VER}.tar.gz https://download.osgeo.org/gdal/${GDAL_VER}/gdal-${GDAL_VER}.tar.gz; \ + if [ -f gdal-${GDAL_VER}.tar.xz ]; then \ + tar -xJf gdal-${GDAL_VER}.tar.xz; \ + else \ + tar -xzf gdal-${GDAL_VER}.tar.gz; \ + fi; \ + cd gdal-${GDAL_VER}; \ + mkdir build && cd build; \ + cmake -G Ninja ../ \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local; \ + cmake --build . -- -j"$(nproc)"; \ + cmake --install .; \ + ldconfig; \ + rm -rf /tmp/gdal-${GDAL_VER}*; \ + rm -rf /var/lib/apt/lists/*; \ + gdal-config --version + +##### + # ------------------------------------------------------------------- # Entrypoint # ------------------------------------------------------------------- @@ -120,6 +148,12 @@ COPY entrypoint.sh /opt/entrypoint.sh RUN chmod +x /opt/entrypoint.sh USER ${USER} + +ENV GDAL_CONFIG=/usr/local/bin/gdal-config +ENV GDAL_DATA=/usr/local/share/gdal +ENV GDAL_DRIVER_PATH=/usr/local/lib/gdalplugins +ENV GDAL_OVERWRITE=YES + WORKDIR /workspace EXPOSE 8888 diff --git a/release.yaml b/release.yaml index 26f025f..25e4f74 100644 --- a/release.yaml +++ b/release.yaml @@ -1,4 +1,4 @@ image_name: pde-code-server image_prefix: eoepca -image_version: 1.2.0 +image_version: 1.3.0 image_registry: ghcr.io \ No newline at end of file