[ci] fix zlib1g security vulnerability
Browse files- dockerfiles/apt_preferences +9 -0
- dockerfiles/debian.sources +17 -0
- dockerfiles/dockerfile-samgis-base +14 -5
- scripts/copy_folder_to_host.sh +0 -12
dockerfiles/apt_preferences
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Explanation: Uninstall or do not install any Debian-originated
|
| 2 |
+
Explanation: package versions other than those in the stable distro
|
| 3 |
+
Package: *
|
| 4 |
+
Pin: release a=stable
|
| 5 |
+
Pin-Priority: 900
|
| 6 |
+
|
| 7 |
+
Package: zlib1g
|
| 8 |
+
Pin: release a=trixie
|
| 9 |
+
Pin-Priority: -10
|
dockerfiles/debian.sources
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Types: deb deb-src
|
| 2 |
+
URIs: http://deb.debian.org/debian
|
| 3 |
+
Suites: bookworm bookworm-updates
|
| 4 |
+
Components: main
|
| 5 |
+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
| 6 |
+
|
| 7 |
+
Types: deb deb-src
|
| 8 |
+
URIs: http://deb.debian.org/debian-security
|
| 9 |
+
Suites: bookworm-security
|
| 10 |
+
Components: main
|
| 11 |
+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
| 12 |
+
|
| 13 |
+
Types: deb
|
| 14 |
+
URIs: http://deb.debian.org/debian
|
| 15 |
+
Suites: trixie
|
| 16 |
+
Components: main
|
| 17 |
+
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
dockerfiles/dockerfile-samgis-base
CHANGED
|
@@ -21,6 +21,7 @@ ARG POETRY_VIRTUALENVS_CREATE
|
|
| 21 |
ARG POETRY_CACHE_DIR
|
| 22 |
ARG RIE
|
| 23 |
ARG DEPENDENCY_GROUP
|
|
|
|
| 24 |
|
| 25 |
RUN echo "ARCH: $ARCH ..."
|
| 26 |
|
|
@@ -36,9 +37,15 @@ WORKDIR ${LAMBDA_TASK_ROOT}
|
|
| 36 |
COPY requirements_poetry.txt pyproject.toml poetry.lock README.md ${LAMBDA_TASK_ROOT}/
|
| 37 |
|
| 38 |
# avoid segment-geospatial exception caused by missing libGL.so.1 library
|
| 39 |
-
|
| 40 |
-
RUN apt update && apt install -y libgl1 curl
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# poetry installation path is NOT within ${LAMBDA_TASK_ROOT}: not needed for runtime docker image
|
| 44 |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_poetry.txt
|
|
@@ -48,8 +55,6 @@ RUN poetry config virtualenvs.path ${LAMBDA_TASK_ROOT}
|
|
| 48 |
RUN echo "# poetry config --list #" && poetry config --list
|
| 49 |
RUN poetry install --with ${DEPENDENCY_GROUP} --no-root
|
| 50 |
|
| 51 |
-
RUN curl -Lo /usr/local/bin/aws-lambda-rie ${RIE}
|
| 52 |
-
|
| 53 |
|
| 54 |
FROM python:3.11-slim-bookworm as runtime
|
| 55 |
|
|
@@ -61,6 +66,10 @@ ENV VIRTUAL_ENV=${LAMBDA_TASK_ROOT}/.venv \
|
|
| 61 |
|
| 62 |
RUN echo "COPY --from=builder_global /usr/lib/${ARCH}-linux-gnu/libGL.so* /usr/lib/${ARCH}-linux-gnu/"
|
| 63 |
COPY --from=builder_global /usr/lib/${ARCH}-linux-gnu/libGL.so* /usr/lib/${ARCH}-linux-gnu/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
COPY --from=builder_global ${LAMBDA_TASK_ROOT}/.venv ${LAMBDA_TASK_ROOT}/.venv
|
| 65 |
|
| 66 |
RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
|
|
|
|
| 21 |
ARG POETRY_CACHE_DIR
|
| 22 |
ARG RIE
|
| 23 |
ARG DEPENDENCY_GROUP
|
| 24 |
+
ARG ZLIB1G="http://ftp.it.debian.org/debian/pool/main/z/zlib/zlib1g_1.3.dfsg-3+b1_amd64.deb"
|
| 25 |
|
| 26 |
RUN echo "ARCH: $ARCH ..."
|
| 27 |
|
|
|
|
| 37 |
COPY requirements_poetry.txt pyproject.toml poetry.lock README.md ${LAMBDA_TASK_ROOT}/
|
| 38 |
|
| 39 |
# avoid segment-geospatial exception caused by missing libGL.so.1 library
|
| 40 |
+
RUN echo "BUILDER: check libz.s* before start" && ls -l /usr/lib/${ARCH}-linux-gnu/libz.so*
|
| 41 |
+
RUN apt update && apt install -y libgl1 curl python3-pip && apt clean
|
| 42 |
+
COPY ./dockerfiles/apt_preferences /etc/apt/preferences
|
| 43 |
+
COPY ./dockerfiles/debian.sources /etc/apt/sources.list.d/debian.sources
|
| 44 |
+
RUN apt update && apt install -t trixie zlib1g -y && apt clean
|
| 45 |
+
RUN echo "BUILDER: check libz.s* after install from trixie" && ls -l /usr/lib/${ARCH}-linux-gnu/libz.so*
|
| 46 |
+
|
| 47 |
+
RUN ls -l /etc/apt/sources* /etc/apt/preferences*
|
| 48 |
+
RUN curl -Lo /usr/local/bin/aws-lambda-rie ${RIE}
|
| 49 |
|
| 50 |
# poetry installation path is NOT within ${LAMBDA_TASK_ROOT}: not needed for runtime docker image
|
| 51 |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_poetry.txt
|
|
|
|
| 55 |
RUN echo "# poetry config --list #" && poetry config --list
|
| 56 |
RUN poetry install --with ${DEPENDENCY_GROUP} --no-root
|
| 57 |
|
|
|
|
|
|
|
| 58 |
|
| 59 |
FROM python:3.11-slim-bookworm as runtime
|
| 60 |
|
|
|
|
| 66 |
|
| 67 |
RUN echo "COPY --from=builder_global /usr/lib/${ARCH}-linux-gnu/libGL.so* /usr/lib/${ARCH}-linux-gnu/"
|
| 68 |
COPY --from=builder_global /usr/lib/${ARCH}-linux-gnu/libGL.so* /usr/lib/${ARCH}-linux-gnu/
|
| 69 |
+
RUN echo "RUNTIME: check libz.s* before upgrade" && ls -l /usr/lib/${ARCH}-linux-gnu/libz.so*
|
| 70 |
+
RUN echo "RUNTIME: remove libz.s* to force upgrade" && rm /usr/lib/${ARCH}-linux-gnu/libz.so*
|
| 71 |
+
COPY --from=builder_global /usr/lib/${ARCH}-linux-gnu/libz.so* /usr/lib/${ARCH}-linux-gnu/
|
| 72 |
+
RUN echo "RUNTIME: check libz.s* after copy" && ls -l /usr/lib/${ARCH}-linux-gnu/libz.so*
|
| 73 |
COPY --from=builder_global ${LAMBDA_TASK_ROOT}/.venv ${LAMBDA_TASK_ROOT}/.venv
|
| 74 |
|
| 75 |
RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
|
scripts/copy_folder_to_host.sh
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env bash
|
| 2 |
-
|
| 3 |
-
echo "options:"
|
| 4 |
-
echo "\$1: container folder we copy from"
|
| 5 |
-
echo "\$2: container folder we copy to (could also be an host folder)"
|
| 6 |
-
|
| 7 |
-
cp -r "$1" "$2"
|
| 8 |
-
echo "copied folder $1 to folder $2!"
|
| 9 |
-
ls -ld "$2"
|
| 10 |
-
ls -l "$2"
|
| 11 |
-
|
| 12 |
-
exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|