From e2ee2f5949066a02484344490db2c6e50ca02825 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Thu, 24 Dec 2020 14:04:47 +0200 Subject: [PATCH 1/9] Switch docker image to ubuntu focal with ubuntugis-unstable --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5207ae4..e2b2423 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ # # ================================================================= -FROM debian:bullseye-slim +FROM ubuntu:focal LABEL maintainer="Just van den Broecke " @@ -74,7 +74,9 @@ ADD pygeoapi/__init__.py /pygeoapi/pygeoapi/ # Run all installs RUN \ # Install dependencies - apt-get update \ + apt-get update -y \ + && apt-get install -y --fix-missing --no-install-recommends software-properties-common \ + && add-apt-repository ppa:ubuntugis/ubuntugis-unstable \ && apt-get --no-install-recommends install -y ${DEB_BUILD_DEPS} ${DEB_PACKAGES} \ # Timezone && cp /usr/share/zoneinfo/${TZ} /etc/localtime\ From 0be38d315361154a4b913f8feef81d9ff7b2f387 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Fri, 25 Dec 2020 22:44:17 +0200 Subject: [PATCH 2/9] Updating dockerfile to use debian packages where available (#585) --- Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index e2b2423..5cd00e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,14 +57,12 @@ LABEL maintainer="Just van den Broecke " ARG TIMEZONE="Europe/London" ARG LOCALE="en_US.UTF-8" ARG ADD_DEB_PACKAGES="" -ARG ADD_PIP_PACKAGES="" # ENV settings ENV TZ=${TIMEZONE} \ DEBIAN_FRONTEND="noninteractive" \ - DEB_BUILD_DEPS="tzdata build-essential libpython3-dev libgdal-dev python3-pip apt-utils curl git unzip" \ - DEB_PACKAGES="locales libgdal28 python3-distutils python3-gdal libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}" \ - PIP_PACKAGES="setuptools==49.3.1 greenlet==0.4.17 gunicorn==20.0.4 gevent==20.9.0 wheel==0.33.4 ${ADD_PIP_PACKAGES}" + DEB_BUILD_DEPS="tzdata build-essential apt-utils curl git unzip" \ + DEB_PACKAGES="locales python3-pip python3-setuptools python3-distutils python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-yaml python3-dateutil python3-pandas python3-tz python3-flask python3-unicodecsv python3-pyproj python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite python3-elasticsearch ${ADD_DEB_PACKAGES}" RUN mkdir -p /pygeoapi/pygeoapi # Add files required for pip/setuptools @@ -86,9 +84,6 @@ RUN \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale LANG=${LOCALE} \ && echo "For ${TZ} date=$(date)" && echo "Locale=$(locale)" \ - # Upgrade pip3 and install packages - && python3 -m pip install --upgrade pip \ - && pip3 install ${PIP_PACKAGES} \ # Install pygeoapi && cd /pygeoapi \ && pip3 install -r requirements.txt \ @@ -101,10 +96,9 @@ RUN \ && curl -O http://schemas.opengis.net/SCHEMAS_OPENGIS_NET.zip \ && unzip ./SCHEMAS_OPENGIS_NET.zip "ogcapi/*" -d /schemas.opengis.net \ # Cleanup TODO: remove unused Locales and TZs - && pip3 uninstall --yes wheel \ - && apt-get remove --purge ${DEB_BUILD_DEPS} -y \ + && apt-get remove --purge -y ${DEB_BUILD_DEPS} \ && apt autoremove -y \ - && apt-get --no-install-recommends install -y python3-gdal \ + && apt-get --no-install-recommends install -y ${DEB_PACKAGES} \ && rm -rf /var/lib/apt/lists/* ADD . /pygeoapi From bb240de2707c3b8e2c96ad9ebbb75e68a1d793c0 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Tue, 29 Dec 2020 21:37:17 +0200 Subject: [PATCH 3/9] Review from Just --- Dockerfile | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5cd00e8..5f1a9e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,8 +61,8 @@ ARG ADD_DEB_PACKAGES="" # ENV settings ENV TZ=${TIMEZONE} \ DEBIAN_FRONTEND="noninteractive" \ - DEB_BUILD_DEPS="tzdata build-essential apt-utils curl git unzip" \ - DEB_PACKAGES="locales python3-pip python3-setuptools python3-distutils python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-yaml python3-dateutil python3-pandas python3-tz python3-flask python3-unicodecsv python3-pyproj python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite python3-elasticsearch ${ADD_DEB_PACKAGES}" + DEB_BUILD_DEPS="software-properties-common curl unzip" \ + DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-yaml python3-dateutil python3-pandas python3-tz python3-flask python3-unicodecsv python3-pyproj python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite python3-elasticsearch ${ADD_DEB_PACKAGES}" RUN mkdir -p /pygeoapi/pygeoapi # Add files required for pip/setuptools @@ -72,17 +72,10 @@ ADD pygeoapi/__init__.py /pygeoapi/pygeoapi/ # Run all installs RUN \ # Install dependencies - apt-get update -y \ - && apt-get install -y --fix-missing --no-install-recommends software-properties-common \ + apt-get update -y && apt-get upgrade -y \ + && apt-get install -y --fix-missing --no-install-recommends ${DEB_BUILD_DEPS} \ && add-apt-repository ppa:ubuntugis/ubuntugis-unstable \ - && apt-get --no-install-recommends install -y ${DEB_BUILD_DEPS} ${DEB_PACKAGES} \ - # Timezone - && cp /usr/share/zoneinfo/${TZ} /etc/localtime\ - && dpkg-reconfigure tzdata \ - # Locale - && sed -i -e "s/# ${LOCALE} UTF-8/${LOCALE} UTF-8/" /etc/locale.gen \ - && dpkg-reconfigure --frontend=noninteractive locales \ - && update-locale LANG=${LOCALE} \ + && apt-get --no-install-recommends install -y ${DEB_PACKAGES} \ && echo "For ${TZ} date=$(date)" && echo "Locale=$(locale)" \ # Install pygeoapi && cd /pygeoapi \ @@ -95,10 +88,10 @@ RUN \ && mkdir /schemas.opengis.net \ && curl -O http://schemas.opengis.net/SCHEMAS_OPENGIS_NET.zip \ && unzip ./SCHEMAS_OPENGIS_NET.zip "ogcapi/*" -d /schemas.opengis.net \ + && rm -f ./SCHEMAS_OPENGIS_NET.zip \ # Cleanup TODO: remove unused Locales and TZs && apt-get remove --purge -y ${DEB_BUILD_DEPS} \ && apt autoremove -y \ - && apt-get --no-install-recommends install -y ${DEB_PACKAGES} \ && rm -rf /var/lib/apt/lists/* ADD . /pygeoapi From c0ccfc417692cb2ea19a5cb0c165e0ed9c21c658 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Wed, 30 Dec 2020 12:02:15 +0200 Subject: [PATCH 4/9] Drop apt-get upgrade --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5f1a9e9..d32685b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,7 +72,7 @@ ADD pygeoapi/__init__.py /pygeoapi/pygeoapi/ # Run all installs RUN \ # Install dependencies - apt-get update -y && apt-get upgrade -y \ + apt-get update -y \ && apt-get install -y --fix-missing --no-install-recommends ${DEB_BUILD_DEPS} \ && add-apt-repository ppa:ubuntugis/ubuntugis-unstable \ && apt-get --no-install-recommends install -y ${DEB_PACKAGES} \ From a638ef78c5941e661d273f0f00cd867babfb96cd Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Wed, 30 Dec 2020 13:23:32 +0200 Subject: [PATCH 5/9] Moving providers to ADD_DEB_PACKAGES variable --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d32685b..19c858e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,13 +56,13 @@ LABEL maintainer="Just van den Broecke " # ARGS ARG TIMEZONE="Europe/London" ARG LOCALE="en_US.UTF-8" -ARG ADD_DEB_PACKAGES="" +ARG ADD_DEB_PACKAGES="python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-pandas python3-pyproj python3-elasticsearch python3-pymongo python3-zarr python3-tinydb" # ENV settings ENV TZ=${TIMEZONE} \ DEBIAN_FRONTEND="noninteractive" \ DEB_BUILD_DEPS="software-properties-common curl unzip" \ - DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-yaml python3-dateutil python3-pandas python3-tz python3-flask python3-unicodecsv python3-pyproj python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite python3-elasticsearch ${ADD_DEB_PACKAGES}" + DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-yaml python3-dateutil python3-tz python3-flask python3-unicodecsv python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}" RUN mkdir -p /pygeoapi/pygeoapi # Add files required for pip/setuptools From 295ce4e239c458cf2fe2595bdda146e03c7d67d8 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Sat, 2 Jan 2021 13:03:03 +0200 Subject: [PATCH 6/9] More dockerfile changes, thanks Just --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19c858e..871903e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ # # ================================================================= -FROM ubuntu:focal +FROM ubuntu:focal-20201106 LABEL maintainer="Just van den Broecke " @@ -53,9 +53,13 @@ LABEL maintainer="Just van den Broecke " # via Docker Volume mapping or within a docker-compose.yml file. See example at # https://github.com/geopython/demo.pygeoapi.io/tree/master/services/pygeoapi +# Build arguments +# add "--build-arg BUILD_DEV_IMAGE=true" to Docker build command when building with test/doc tools + # ARGS ARG TIMEZONE="Europe/London" ARG LOCALE="en_US.UTF-8" +ARG BUILD_DEV_IMAGE="false" ARG ADD_DEB_PACKAGES="python3-gdal python3-psycopg2 python3-xarray python3-scipy python3-netcdf4 python3-rasterio python3-fiona python3-pandas python3-pyproj python3-elasticsearch python3-pymongo python3-zarr python3-tinydb" # ENV settings @@ -80,9 +84,8 @@ RUN \ # Install pygeoapi && cd /pygeoapi \ && pip3 install -r requirements.txt \ - && pip3 install -r requirements-dev.txt \ - && pip3 install -r requirements-manager.txt \ - && pip3 install -r requirements-provider.txt \ + # Optionally add development/test/doc packages + && if [ "$BUILD_DEV_IMAGE" = "true" ] ; then pip3 install -r requirements-dev.txt; fi \ && pip3 install -e . \ # OGC schemas local setup && mkdir /schemas.opengis.net \ From 3ccaed04f369acf5125441f7922af93bb50a8b5b Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Sat, 2 Jan 2021 13:32:24 +0200 Subject: [PATCH 7/9] Update Travis to use dev docker build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4875b91..1b13433 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ install: - pip3 install -r requirements-provider.txt - python3 setup.py install # verify docker build - - docker build -t geopython/pygeoapi:latest . + - docker build --build-arg BUILD_DEV_IMAGE=true -t geopython/pygeoapi:latest . before_script: - sleep 20 From 616f1b2993e3601eefe39d88501b505c12f20ada Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Sun, 3 Jan 2021 21:21:04 +0200 Subject: [PATCH 8/9] Added python3-flask-cors package --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 871903e..fdf7248 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,7 +66,7 @@ ARG ADD_DEB_PACKAGES="python3-gdal python3-psycopg2 python3-xarray python3-scipy ENV TZ=${TIMEZONE} \ DEBIAN_FRONTEND="noninteractive" \ DEB_BUILD_DEPS="software-properties-common curl unzip" \ - DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-yaml python3-dateutil python3-tz python3-flask python3-unicodecsv python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}" + DEB_PACKAGES="python3-pip python3-setuptools python3-distutils python3-yaml python3-dateutil python3-tz python3-flask python3-flask-cors python3-unicodecsv python3-click python3-greenlet python3-gevent python3-wheel gunicorn libsqlite3-mod-spatialite ${ADD_DEB_PACKAGES}" RUN mkdir -p /pygeoapi/pygeoapi # Add files required for pip/setuptools @@ -83,7 +83,6 @@ RUN \ && echo "For ${TZ} date=$(date)" && echo "Locale=$(locale)" \ # Install pygeoapi && cd /pygeoapi \ - && pip3 install -r requirements.txt \ # Optionally add development/test/doc packages && if [ "$BUILD_DEV_IMAGE" = "true" ] ; then pip3 install -r requirements-dev.txt; fi \ && pip3 install -e . \ From 959c89540ccc89734b1a51f118ea5591ab72e0f2 Mon Sep 17 00:00:00 2001 From: Angelos Tzotsos Date: Sun, 3 Jan 2021 21:25:02 +0200 Subject: [PATCH 9/9] Unpin focal image --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fdf7248..f55d324 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,12 @@ # Authors: Tom Kralidis # Just van den Broecke # Francesco Bartoli +# Angelos Tzotsos # # Copyright (c) 2020 Tom Kralidis # Copyright (c) 2019 Just van den Broecke # Copyright (c) 2020 Francesco Bartoli +# Copyright (c) 2021 Angelos Tzotsos # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -31,7 +33,7 @@ # # ================================================================= -FROM ubuntu:focal-20201106 +FROM ubuntu:focal LABEL maintainer="Just van den Broecke "