Skip to content

Commit

Permalink
Docker alpine: Fix for PEP-668 (#3463)
Browse files Browse the repository at this point in the history
* fix pip use (PEP 668) after alpine docker image was updated to alpine 3.19,
* set PYTHONPATH
* add pip --no-cache-dir option
  • Loading branch information
mmacata committed Mar 5, 2024
1 parent dcb41fa commit 9cb4745
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.19 as common
FROM python:3-alpine3.19 as common

# Based on:
# https://github.com/mundialis/docker-grass-gis/blob/master/Dockerfile
Expand Down Expand Up @@ -79,7 +79,7 @@ RUN echo "Install Python";\
apk add --no-cache $PYTHONBIN && \
$PYTHONBIN -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip$PYTHON_VERSION install --upgrade pip setuptools && \
pip$PYTHON_VERSION install --no-cache-dir --upgrade pip setuptools && \
if [ ! -e /usr/bin/pip ]; then ln -s pip$PYTHON_VERSION /usr/bin/pip ; fi && \
if [ ! -e /usr/bin/python ]; then ln -sf /usr/bin/$PYTHONBIN /usr/bin/python; fi && \
rm -r /root/.cache; \
Expand Down Expand Up @@ -206,7 +206,8 @@ ENV GRASSBIN="/usr/local/bin/grass" \
# https://proj.org/usage/environmentvars.html#envvar-PROJ_NETWORK
PROJ_NETWORK=ON \
GRASSBIN=grass \
LC_ALL="en_US.UTF-8"
LC_ALL="en_US.UTF-8" \
PYTHONPATH="/usr/local/grass/etc/python:$PYTHONPATH"

# Copy GRASS GIS and GDAL GRASS driver from build image
COPY --from=build /usr/local/bin/grass /usr/local/bin/grass
Expand All @@ -218,7 +219,7 @@ COPY docker/testdata/test_grass_session.py docker/alpine/grass_tests.sh /scripts
COPY docker/testdata/test_grass_session.py /scripts/

# install external Python API
RUN pip3 install --upgrade pip six grass-session --ignore-installed six; \
RUN pip3 install --no-cache-dir --upgrade pip six grass-session --ignore-installed six; \
ln -sf /usr/local/grass $(grass --config path); \
# run some tests and cleanup
$SHELL /scripts/grass_tests.sh \
Expand Down

0 comments on commit 9cb4745

Please sign in to comment.