"Fossies" - the Fresh Open Source Software Archive

Member "gdal-3.0.2/docker/alpine-small/Dockerfile" (28 Oct 2019, 4107 Bytes) of package /linux/privat/gdal-3.0.2.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ##
    2 # osgeo/gdal:alpine-small
    3 
    4 # This file is available at the option of the licensee under:
    5 # Public domain
    6 # or licensed under X/MIT (LICENSE.TXT) Copyright 2019 Even Rouault <even.rouault@spatialys.com>
    7 
    8 FROM alpine:latest as builder
    9 
   10 # Derived from osgeo/proj by Howard Butler <howard@hobu.co>
   11 MAINTAINER Even Rouault <even.rouault@spatialys.com>
   12 
   13 # Setup build env for PROJ
   14 RUN apk add --no-cache wget curl unzip make libtool autoconf automake pkgconfig g++ sqlite sqlite-dev
   15 
   16 # For GDAL
   17 RUN apk add --no-cache \
   18     linux-headers \
   19     curl-dev \
   20     zlib-dev zstd-dev \
   21     libjpeg-turbo-dev libpng-dev openjpeg-dev libwebp-dev expat-dev postgresql-dev
   22 
   23 ARG PROJ_VERSION=master
   24 
   25 # Build PROJ
   26 RUN mkdir proj \
   27     && wget -q https://github.com/OSGeo/proj.4/archive/${PROJ_VERSION}.tar.gz -O - \
   28         | tar xz -C proj --strip-components=1 \
   29     && cd proj \
   30     && ./autogen.sh \
   31     && ./configure --prefix=/usr --disable-static --enable-lto \
   32     && make -j$(nproc) \
   33     && make install \
   34     && make install DESTDIR="/build_proj" \
   35     && cd .. \
   36     && rm -rf proj \
   37     && for i in /build_proj/usr/lib/*; do strip -s $i 2>/dev/null || /bin/true; done \
   38     && for i in /build_proj/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done
   39 
   40 ARG GDAL_VERSION=master
   41 ARG GDAL_RELEASE_DATE
   42 ARG GDAL_BUILD_IS_RELEASE
   43 
   44 # Build GDAL
   45 RUN if test "${GDAL_VERSION}" = "master"; then \
   46         export GDAL_VERSION=$(curl -Ls https://api.github.com/repos/OSGeo/gdal/commits/HEAD -H "Accept: application/vnd.github.VERSION.sha"); \
   47         export GDAL_RELEASE_DATE=$(date "+%Y%m%d"); \
   48     fi \
   49     && if test "x${GDAL_BUILD_IS_RELEASE}" = "x"; then \
   50         export GDAL_SHA1SUM=${GDAL_VERSION}; \
   51     fi \
   52     && mkdir gdal \
   53     && wget -q https://github.com/OSGeo/gdal/archive/${GDAL_VERSION}.tar.gz -O - \
   54         | tar xz -C gdal --strip-components=1 \
   55     && cd gdal/gdal \
   56     && ./configure --prefix=/usr --without-libtool \
   57     --with-hide-internal-symbols \
   58     --with-proj=/usr \
   59     --with-libtiff=internal --with-rename-internal-libtiff-symbols \
   60     --with-geotiff=internal --with-rename-internal-libgeotiff-symbols \
   61     --enable-lto \
   62     && make -j$(nproc) \
   63     && make install DESTDIR="/build" \
   64     && cd ../.. \
   65     && rm -rf gdal \
   66     && for i in /build/usr/lib/*; do strip -s $i 2>/dev/null || /bin/true; done \
   67     && for i in /build/usr/bin/*; do strip -s $i 2>/dev/null || /bin/true; done \
   68     # Remove resource files of uncompiled drivers
   69     && (for i in \
   70             # BAG driver
   71             /build/usr/share/gdal/bag*.xml \
   72             # unused
   73             /build/usr/share/gdal/*.svg \
   74             # unused
   75             /build/usr/share/gdal/*.png \
   76             # GMLAS driver
   77             /build/usr/share/gdal/gmlas* \
   78             # netCDF driver
   79             /build/usr/share/gdal/netcdf_config.xsd \
   80        ;do rm $i; done)
   81 
   82 RUN \
   83     mkdir -p /build_projgrids/usr/share/proj \
   84     && curl -LOs http://download.osgeo.org/proj/proj-datumgrid-latest.zip \
   85     && unzip -q -j -u -o proj-datumgrid-latest.zip  -d /build_projgrids/usr/share/proj \
   86     && rm -f *.zip
   87 
   88 # Build final image
   89 FROM alpine:latest as runner
   90 
   91 RUN date
   92 
   93 RUN apk add --no-cache \
   94         libstdc++ \
   95         sqlite-libs \
   96         libcurl \
   97         zlib zstd-libs\
   98         libjpeg-turbo libpng openjpeg libwebp expat libpq \
   99     # libturbojpeg.so is not used by GDAL. Only libjpeg.so*
  100     && rm -f /usr/lib/libturbojpeg.so* \
  101     # Only libwebp.so is used by GDAL
  102     && rm -f /usr/lib/libwebpmux.so* /usr/lib/libwebpdemux.so* /usr/lib/libwebpdecoder.so*
  103 
  104 # Order layers starting with less frequently varying ones
  105 COPY --from=builder  /build_projgrids/usr/ /usr/
  106 
  107 COPY --from=builder  /build_proj/usr/share/proj/ /usr/share/proj/
  108 COPY --from=builder  /build_proj/usr/include/ /usr/include/
  109 COPY --from=builder  /build_proj/usr/bin/ /usr/bin/
  110 COPY --from=builder  /build_proj/usr/lib/ /usr/lib/
  111 
  112 COPY --from=builder  /build/usr/share/gdal/ /usr/share/gdal/
  113 COPY --from=builder  /build/usr/include/ /usr/include/
  114 COPY --from=builder  /build/usr/bin/ /usr/bin/
  115 COPY --from=builder  /build/usr/lib/ /usr/lib/