Skip to content

Commit

Permalink
Merge pull request #1046 from pjonsson/dockerfile-gdal-update
Browse files Browse the repository at this point in the history
Dockerfile: update to GDAL 3.9.1
  • Loading branch information
SpacemanPaul authored Aug 8, 2024
2 parents c2a272a + f07fece commit 2763129
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Note that this is now pinned to a fixed version. Remember to check for new versions periodically.
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5 AS builder
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.1 AS builder

# Setup build env for postgresql-client-14
# Setup build env for postgresql-client-16
USER root
RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing --no-install-recommends \
git \
# For pybabel
python3-distutils \
# For Psycopg2
libpq-dev python3-dev \
gcc \
python3-pip \
postgresql-client-14 \
postgresql-client-16 \
# For Pyproj build \
proj-bin proj-data libproj-dev \
&& apt-get clean \
Expand All @@ -25,18 +23,18 @@ WORKDIR /code
COPY . /code

RUN echo "version=\"$(python3 setup.py --version)\"" > datacube_ows/_version.py \
&& pip install --no-cache-dir .[ops,test]
&& pip --disable-pip-version-check install --no-cache-dir .[ops,test] --break-system-packages

## Only install pydev requirements if arg PYDEV_DEBUG is set to 'yes'
ARG PYDEV_DEBUG="no"
RUN if [ "$PYDEV_DEBUG" = "yes" ]; then \
pip install --no-cache-dir .[dev] \
pip --disable-pip-version-check install --no-cache-dir .[dev] --break-system-packages \
;fi

RUN pip freeze

# Should match builder base.
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.5
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.1

RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand All @@ -49,9 +47,8 @@ RUN apt-get update -y \
COPY --chown=root:root --link docker/files/remap-user.sh /usr/local/bin/remap-user.sh

# all the python pip installed libraries
COPY --from=builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages
COPY --from=builder /usr/local/lib/python3.12/dist-packages /usr/local/lib/python3.12/dist-packages
COPY --from=builder /usr/lib/python3/dist-packages /usr/lib/python3/dist-packages
COPY --from=builder /usr/lib/python3.10/distutils/* /usr/lib/python3.10/distutils/
# postgres client
COPY --from=builder /usr/lib/postgresql /usr/lib/postgresql
COPY --from=builder /usr/share/postgresql /usr/share/postgresql
Expand All @@ -78,15 +75,12 @@ WORKDIR /code
COPY . /code

# Configure user
RUN useradd -m -s /bin/bash ows
WORKDIR "/home/ows"
WORKDIR "/home/ubuntu"

ENV GDAL_DISABLE_READDIR_ON_OPEN="EMPTY_DIR" \
CPL_VSIL_CURL_ALLOWED_EXTENSIONS=".tif, .tiff" \
GDAL_HTTP_MAX_RETRY="10" \
GDAL_HTTP_RETRY_DELAY="1"

RUN chown 1000:100 /dev/shm

ENTRYPOINT ["/usr/local/bin/remap-user.sh"]
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--workers=3", "--threads=2", "-k", "gevent", "--timeout", "121", "--pid", "/home/ows/gunicorn.pid", "--log-level", "info", "--worker-tmp-dir", "/dev/shm", "--config", "python:datacube_ows.gunicorn_config", "datacube_ows.wsgi"]
CMD ["gunicorn", "-b", "0.0.0.0:8000", "--workers=3", "--threads=2", "-k", "gevent", "--timeout", "121", "--pid", "/home/ubuntu/gunicorn.pid", "--log-level", "info", "--worker-tmp-dir", "/dev/shm", "--config", "python:datacube_ows.gunicorn_config", "datacube_ows.wsgi"]
2 changes: 1 addition & 1 deletion docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

services:
ows_18:
command: gunicorn -b '0.0.0.0:8000' --workers=3 --threads=2 -k gevent --timeout 121 --pid /home/ows/gunicorn.pid --log-level info --worker-tmp-dir /dev/shm --config python:datacube_ows.gunicorn_config datacube_ows.wsgi
command: gunicorn -b '0.0.0.0:8000' --workers=3 --threads=2 -k gevent --timeout 121 --pid /home/ubuntu/gunicorn.pid --log-level info --worker-tmp-dir /dev/shm --config python:datacube_ows.gunicorn_config datacube_ows.wsgi
6 changes: 3 additions & 3 deletions docker/files/remap-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
USER_ID=${LOCAL_UID:-1000}
GROUP_ID=${LOCAL_GID:-1000}

[[ "$USER_ID" == "1000" ]] || usermod -u $USER_ID -o -m -d /home/ows ows
[[ "$GROUP_ID" == "1000" ]] || groupmod -g $GROUP_ID ows
[[ $(id -u) != "0" ]] || GOSU="/usr/sbin/gosu ows"
[[ "$USER_ID" == "1000" ]] || usermod -u $USER_ID -o -m -d /home/ubuntu ubuntu
[[ "$GROUP_ID" == "1000" ]] || groupmod -g $GROUP_ID ubuntu
[[ $(id -u) != "0" ]] || GOSU="/usr/sbin/gosu ubuntu"
exec /usr/bin/tini -- $GOSU "$@"

0 comments on commit 2763129

Please sign in to comment.