Skip to content

Commit

Permalink
docker: upgrade ubuntu version (#1093)
Browse files Browse the repository at this point in the history
* docker: upgrade ubuntu version

Upgrade rhe ubuntu version used in the main Dockerfile to latest stable version `20.04`

* Update Dockerfile

amended ubuntu version 20 -> 22

but then the following error:

```
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
gpg: error running '/usr/bin/gpg-agent': probably not installed
gpg: failed to start agent '/usr/bin/gpg-agent': Configuration error
gpg: can't connect to the agent: Configuration error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 423, in add_key
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/ubuntugis/ubuntugis-unstable/ubuntu/ jammy main'
Description:
Unstable releases of Ubuntu GIS packages. These releases are more bleeding edge and while generally they should work well, they dont receive the same amount of quality assurance as our stable releases do.
More info: https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable
Adding repository.
Adding deb entry to /etc/apt/sources.list.d/ubuntugis-ubuntu-ubuntugis-unstable-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ubuntugis-ubuntu-ubuntugis-unstable-jammy.list
Adding key to /etc/apt/trusted.gpg.d/ubuntugis-ubuntu-ubuntugis-unstable.gpg with fingerprint 6B827C12C2D425E227EDCA75089EBE08314DF160
    subprocess.run(cmd.split(), check=True, input=keys)
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gpg', '-q', '--no-options', '--no-default-keyring', '--batch', '--keyring', '/etc/apt/trusted.gpg.d/ubuntugis-ubuntu-ubuntugis-unstable.gpg', '--homedir', '/tmp/tmpjlr98185', '--import']' returned non-zero exit status 2.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/add-apt-repository", line 357, in main
    shortcut.add()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 222, in add
    self.add_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuthandler.py", line 425, in add_key
    raise ShortcutException(e)
softwareproperties.shortcuthandler.ShortcutException: Command '['gpg', '-q', '--no-options', '--no-default-keyring', '--batch', '--keyring', '/etc/apt/trusted.gpg.d/ubuntugis-ubuntu-ubuntugis-unstable.gpg', '--homedir', '/tmp/tmpjlr98185', '--import']' returned non-zero exit status 2.
````

Removing the ubuntugis PPA  build without error - is ubuntugis a requirements? probably Jammy has up-to-date packages for pygeoapi dependencies

* Update Dockerfile

removing ubuntugis PPA

* Update Dockerfile

adding  `python3-pytest` and `python3-pyld`  dependencies

* Update Dockerfile

* Update Dockerfile

* fixing docker environment with suggested changes

* replace ubuntu version with codename

* Update .dockerignore

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update entrypoint.sh

skip the SensorThings and other tests that require a local server

Co-authored-by: Just van den Broecke <just@justobjects.nl>
  • Loading branch information
epifanio and justb4 committed Jan 18, 2023
1 parent a1a70a4 commit 2d4d8e6
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 60 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
@@ -0,0 +1,8 @@
.git
.github
.pytest_cache
build
dist
docs
pygeoapi.egg-info

105 changes: 46 additions & 59 deletions Dockerfile
Expand Up @@ -33,7 +33,7 @@
#
# =================================================================

FROM ubuntu:focal
FROM ubuntu:jammy

LABEL maintainer="Just van den Broecke <justb4@gmail.com>"

Expand All @@ -55,14 +55,11 @@ LABEL maintainer="Just van den Broecke <justb4@gmail.com>"
# 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 TZ="Etc/UTC"
ARG LANG="en_US.UTF-8"
ARG BUILD_DEV_IMAGE="false"
ARG ADD_DEB_PACKAGES="\
libsqlite3-mod-spatialite \
python3-dask \
python3-elasticsearch \
python3-fiona \
Expand All @@ -74,83 +71,73 @@ ARG ADD_DEB_PACKAGES="\
python3-pyproj \
python3-rasterio \
python3-scipy \
python3-shapely \
python3-tinydb \
python3-xarray \
python3-zarr \
python3-mapscript \
"
python3-pytest \
python3-pyld"

# ENV settings
ENV TZ=${TZ} \
LANG=${LANG} \
DEBIAN_FRONTEND="noninteractive" \
DEB_BUILD_DEPS="\
gcc-aarch64-linux-gnu \
curl \
python3-dev \
software-properties-common \
unzip" \
curl \
unzip" \
DEB_PACKAGES="\
gunicorn \
libsqlite3-mod-spatialite \
locales \
locales-all \
python3-dateutil \
python3-distutils \
python3-flask \
python3-flask-cors \
python3-gevent \
python3-greenlet \
python3-pip \
python3-setuptools \
python3-shapely \
python3-tz \
python3-unicodecsv \
python3-wheel \
python3-yaml \
${ADD_DEB_PACKAGES}"
locales \
tzdata \
gunicorn \
python3-dateutil \
python3-flask \
python3-flask-cors \
python3-gevent \
python3-greenlet \
python3-pip \
python3-tz \
python3-unicodecsv \
python3-yaml \
${ADD_DEB_PACKAGES}"

WORKDIR /pygeoapi
ADD . /pygeoapi

# Install operating system dependencies
RUN \
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_PACKAGES} \
&& update-locale LANG=${LANG} \
&& echo "For ${TZ} date=$(date)" && echo "Locale=$(locale)"

# OGC schemas local setup
WORKDIR /schemas.opengis.net
RUN \
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
&& apt-get --no-install-recommends install -y ${DEB_PACKAGES} ${DEB_BUILD_DEPS} \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& echo "For ${TZ} date=$(date)" && echo "Locale=$(locale)" \

WORKDIR /pygeoapi
RUN mkdir -p /pygeoapi/pygeoapi
# Add files required for pip/setuptools
ADD requirements*.txt setup.py README.md /pygeoapi/
ADD pygeoapi/__init__.py /pygeoapi/pygeoapi/
# temporary remove
# && add-apt-repository ppa:ubuntugis/ubuntugis-unstable \

# OGC schemas local setup
&& 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 \

RUN \
# Install pygeoapi
# Optionally add development/test/doc packages
if [ "$BUILD_DEV_IMAGE" = "true" ] ; then pip3 install -r requirements-dev.txt; fi \
# Install pygeoapi providers
&& pip3 install -r requirements-provider.txt \

# Install remaining pygeoapi deps
&& pip3 install -r requirements-docker.txt \

# Install pygeoapi
&& pip3 install -e .
&& pip3 install -e . \

# Set default config and entrypoint for Docker Image
&& cp /pygeoapi/docker/default.config.yml /pygeoapi/local.config.yml \
&& cp /pygeoapi/docker/entrypoint.sh /entrypoint.sh \

RUN \
# Cleanup TODO: remove unused Locales and TZs
apt-get remove --purge -y ${DEB_BUILD_DEPS} \
&& apt-get remove --purge -y gcc ${DEB_BUILD_DEPS} \
&& apt-get clean \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*

ADD . /pygeoapi

COPY ./docker/default.config.yml /pygeoapi/local.config.yml
COPY ./docker/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

ENTRYPOINT ["/entrypoint.sh"]
4 changes: 3 additions & 1 deletion docker/entrypoint.sh
Expand Up @@ -75,8 +75,10 @@ case ${entry_cmd} in
case ${test_py} in
tests/test_elasticsearch__provider.py)
;&
tests/test_sensorthings_provider.py)
;&
tests/test_postgresql_provider.py)
;&
;&
tests/test_mongo_provider.py)
echo "Skipping: ${test_py}"
;;
Expand Down
6 changes: 6 additions & 0 deletions requirements-docker.txt
@@ -0,0 +1,6 @@
elasticsearch-dsl<8
geoalchemy
pygeofilter[backend-sqlalchemy]
pygeoif<1.0.0
pygeometa
sodapy

0 comments on commit 2d4d8e6

Please sign in to comment.