Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: cleanup alpine Dockerfile and drop Dockerfile_alpine_latest #2912

Merged
merged 13 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
docker
!docker/testdata
!docker/alpine/grass_tests.sh
.gitignore
.github
.travis
Expand Down
66 changes: 15 additions & 51 deletions docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ LABEL maintainer="neteler@osgeo.org"
ARG PYTHON_VERSION=3

# List of packages to be installed (proj-data omitted: 570.04 MB)
ENV PACKAGES="\
ENV GRASS_RUN_PACKAGES="\
attr \
build-base \
bash \
bison \
bzip2 \
Expand All @@ -19,6 +20,8 @@ ENV PACKAGES="\
fftw \
flex \
freetype \
g++ \
gcc \
gdal \
gdal-dev \
gdal-tools \
Expand All @@ -32,6 +35,7 @@ ENV PACKAGES="\
libgeotiff \
libjpeg-turbo \
libpng \
libpq-dev \
libunwind \
make \
musl \
Expand Down Expand Up @@ -73,7 +77,7 @@ RUN echo "Install Python";\
# Add the packages
RUN echo "Install main packages";\
apk update; \
apk add --no-cache $PACKAGES
apk add --no-cache $GRASS_RUN_PACKAGES


FROM common as build
Expand Down Expand Up @@ -121,17 +125,13 @@ ENV GRASS_BUILD_PACKAGES="\
cairo-dev \
fftw-dev \
freetype-dev \
g++ \
gcc \
gdal-dev \
geos-dev \
git \
gnutls-dev \
libc6-compat \
libjpeg-turbo-dev \
libpng-dev \
libpq-dev \
make \
openjpeg-dev \
openblas-dev \
pdal \
Expand Down Expand Up @@ -187,39 +187,8 @@ COPY --from=build /usr/local/grass* /usr/local/grass/
# install external Python API
RUN pip3 install --upgrade pip six grass-session --ignore-installed six

# TODO: still needed?
RUN ln -sf /usr/local/grass $(grass --config path)
RUN grass --tmp-location XY --exec g.version -rge && \
pdal --version && \
python3 --version


FROM grass as test

## run simple LAZ test
COPY docker/testdata/simple.laz /tmp/simple.laz
COPY docker/testdata/test_grass_session.py /scripts/test_grass_session.py
ENV GRASSBIN=grass

# Test grass-session
# Not yet ready for GRASS GIS 8:
RUN /usr/bin/python3 /scripts/test_grass_session.py
# Test PDAL
RUN grass --tmp-location EPSG:25832 --exec r.in.pdal input="/tmp/simple.laz" output="count_1" method="n" resolution=1 -g

# Test addon installation
RUN apk add --no-cache py3-scikit-learn
RUN grass --tmp-location XY --exec g.extension extension=r.learn.ml2


FROM grass as final

# These packages are required to run g.extension in GRASS GIS.
ENV GRASS_RUN_PACKAGES="\
build-base \
gcc \
libpq-dev \
make \
"

# GRASS GIS specific
# allow work with MAPSETs that are not owned by current user
Expand All @@ -230,26 +199,21 @@ ENV GRASSBIN="/usr/local/bin/grass" \
# https://proj.org/usage/environmentvars.html#envvar-PROJ_NETWORK
ENV PROJ_NETWORK=ON

# Add packages for fully enabling g.extension
RUN apk add --no-cache $GRASS_RUN_PACKAGES
## run simple LAZ test
COPY docker/testdata/simple.laz /tmp/
COPY docker/testdata/test_grass_session.py /scripts/
COPY docker/alpine/grass_tests.sh /scripts/
ENV GRASSBIN=grass

# addon test in final stage: does g.extension install also C-extensions?
# test raster C addon
RUN grass --tmp-location XY --exec g.extension extension=r.gwr operation=add
RUN grass --tmp-location XY --exec g.extension extension=r.gwr operation=remove -f
# test vector C addon
RUN grass --tmp-location XY --exec g.extension extension=v.centerpoint operation=add
RUN grass --tmp-location XY --exec g.extension extension=v.centerpoint operation=remove -f
# run some tests and cleanup
RUN /bin/bash /scripts/grass_tests.sh && rm -f /scripts/grass_tests.sh \
/tmp/simple.laz /scripts/test_grass_session.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that these files were added in a previous stage, so removing them has no effect in image size, just more organized content of image. So I would still vote for removing them here.


# show installed version
RUN grass --tmp-location XY --exec g.version -rge && \
pdal --version && \
python3 --version

# test r.in.pdal in final image because test stage is not executed in github action
COPY docker/testdata/simple.laz /tmp/simple.laz
RUN grass --tmp-location EPSG:25832 --exec r.in.pdal input="/tmp/simple.laz" output="count_1" method="n" resolution=1 -g

# Data workdir
WORKDIR /grassdb
VOLUME /grassdb
Expand Down
238 changes: 0 additions & 238 deletions docker/alpine/Dockerfile_alpine_latest

This file was deleted.