-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
Conversation
- drop `Dockerfile_alpine_latest` as being unsed - cleanup `Dockerfile`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for simplification :)
docker/alpine/Dockerfile
Outdated
RUN /bin/bash /scripts/grass_tests.sh && rm -f /scripts/grass_tests.sh \ | ||
/tmp/simple.laz /scripts/test_grass_session.py |
There was a problem hiding this comment.
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.
I checked the docker image size, with respect to the biggest included packages:
Candidates to be removed:
Done in 52b4f17. Current size: 684 MB. I don't see much potential to further shrink the docker image size but suggestions are welcome. |
I tried grouping some layers in a Docker file, something like this: FROM common as grass
# GRASS GIS specific
# allow work with MAPSETs that are not owned by current user
ENV GRASSBIN="/usr/local/bin/grass" \
GRASS_SKIP_MAPSET_OWNER_CHECK=1 \
SHELL="/bin/bash" \
# https://proj.org/usage/environmentvars.html#envvar-PROJ_NETWORK
PROJ_NETWORK=ON \
GRASSBIN=grass \
LC_ALL="en_US.UTF-8"
# Copy GRASS GIS from build image
COPY --from=build /usr/local/bin/grass /usr/local/bin/grass
COPY --from=build /usr/local/grass* /usr/local/grass/
# run simple LAZ test
COPY docker/testdata/simple.laz /tmp/
# 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; \
ln -sf /usr/local/grass $(grass --config path); \
# run some tests and cleanup
# $SHELL /scripts/grass_tests.sh \
# && rm -f /scripts/grass_tests.sh /tmp/simple.laz /scripts/test_grass_session.py; \
# delete unused packages
apk del --no-cache gettext pdal-dev; \
# show installed version
grass --tmp-location XY --exec g.version -rge \
&& pdal --version \
&& python3 --version
# Data workdir
WORKDIR /grassdb
VOLUME /grassdb
CMD ["$GRASSBIN", "--version"] It reduced the image size to 669MB. It's not too much.
Note: This file # COPY docker/testdata/test_grass_session.py docker/alpine/grass_tests.sh /scripts/
...
# run some tests and cleanup
# /bin/bash /scripts/grass_tests.sh \
# && rm -f /scripts/grass_tests.sh /tmp/simple.laz /scripts/test_grass_session.py; \ |
Remove dev packages from ENV GRASS_RUN_PACKAGES="\
attr \
build-base \
bash \
bison \
bzip2 \
cairo \
curl \
fftw \
flex \
freetype \
g++ \
gcc \
gdal \
gdal-tools \
gettext \
geos \
gnutls \
jsoncpp \
laszip \
libbz2 \
libgeotiff \
libjpeg-turbo \
libpng \
libunwind \
make \
musl \
musl-utils \
ncurses \
openjpeg \
openblas \
py3-numpy \
py3-pillow \
py3-six \
pdal \
postgresql \
proj-util \
sqlite \
sqlite-libs \
subversion \
tiff \
zstd \
zstd-libs \
" ENV GRASS_BUILD_PACKAGES="\
build-base \
bzip2-dev \
cairo-dev \
fftw-dev \
freetype-dev \
geos-dev \
git \
gnutls-dev \
libc6-compat \
libjpeg-turbo-dev \
libpng-dev \
libpq-dev \
openjpeg-dev \
openblas-dev \
pdal \
pdal-dev \
proj-dev \
python3-dev \
py3-numpy-dev \
sqlite-dev \
tar \
tiff-dev \
unzip \
vim \
wget \
zip \
zstd-dev \
gdal-dev \
" Group layers: 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 && \
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; \
# Add the packages
echo "Install main packages";\
apk update; \
apk add --no-cache $GRASS_RUN_PACKAGES It reduced the image size from 669MB to 659MB.
|
@tmszi: This surprises me - it was exactly the reason to add them to run-time but I am no expert here. So, using:
Updates in this PR would trigger the tests which I recently added in |
Oh sorry, added in e1f2fd1. |
Added |
Yes your are right. These dev packages is required for v.centerpoint addon compilation.
|
I replaced postgresql package for GRASS GIS runtime with postgresql15-client wich is sufficient for connection to PostgreSQL DB. We don't need launch PostgreSQL DB server under Docker container right? |
Confirmed, we don' need a PG server here. |
- drop `Dockerfile_alpine_latest` as being unsed - cleanup `Dockerfile` Co-authored-by: @tmszi
- drop `Dockerfile_alpine_latest` as being unsed - cleanup `Dockerfile` Co-authored-by: @tmszi (not to be backported)
Dockerfile_alpine_latest
as being unsedDockerfile
(not to be backported)