2022-09-15 19:35:42 +02:00
|
|
|
ARG DOCKER_HUB_PROXY=""
|
|
|
|
|
2024-07-18 16:54:57 +02:00
|
|
|
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
|
2023-05-16 16:26:20 +02:00
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
ARG MODULES_TAG
|
|
|
|
ARG MODULES_COMMIT
|
2023-09-12 11:23:20 +02:00
|
|
|
ARG LIBFAUP_COMMIT
|
2023-09-17 13:37:02 +02:00
|
|
|
|
2023-05-16 16:26:20 +02:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
cmake \
|
|
|
|
git \
|
|
|
|
build-essential \
|
|
|
|
libpoppler-cpp-dev \
|
|
|
|
libfuzzy-dev \
|
2024-07-18 16:36:06 +02:00
|
|
|
libffi-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2023-05-16 16:26:20 +02:00
|
|
|
libssl-dev \
|
2023-09-12 11:23:20 +02:00
|
|
|
ninja-build \
|
2023-05-16 16:26:20 +02:00
|
|
|
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
2024-07-18 16:36:06 +02:00
|
|
|
|
2023-06-15 13:55:16 +02:00
|
|
|
RUN mkdir /wheels
|
2020-02-25 02:14:24 +01:00
|
|
|
|
2023-09-12 11:23:20 +02:00
|
|
|
RUN <<-EOF
|
2023-09-12 11:25:37 +02:00
|
|
|
if [ ! -z ${MODULES_COMMIT} ]; then
|
|
|
|
git clone https://github.com/MISP/misp-modules.git /srv/misp-modules && cd /srv/misp-modules && git checkout ${MODULES_COMMIT}
|
|
|
|
else
|
|
|
|
git clone --branch ${MODULES_TAG} --depth 1 https://github.com/MISP/misp-modules.git /srv/misp-modules
|
|
|
|
fi
|
2023-09-12 11:23:20 +02:00
|
|
|
EOF
|
2020-02-25 02:14:24 +01:00
|
|
|
|
2024-07-18 16:36:06 +02:00
|
|
|
WORKDIR /srv/misp-modules
|
|
|
|
RUN pip install pipenv
|
|
|
|
RUN pipenv requirements > requirements.txt
|
|
|
|
RUN pip wheel -r requirements.txt --no-cache-dir -w /wheels/
|
|
|
|
|
|
|
|
WORKDIR /srv/
|
|
|
|
RUN rm -rf /srv/misp-modules
|
|
|
|
|
2023-09-12 11:23:20 +02:00
|
|
|
RUN <<-EOF
|
|
|
|
git clone --depth 1 https://github.com/stricaud/faup.git /srv/faup
|
|
|
|
cd /srv/faup
|
2023-09-12 11:24:18 +02:00
|
|
|
if [ ! -z ${LIBFAUP_COMMIT} ]; then
|
|
|
|
git checkout ${LIBFAUP_COMMIT}
|
|
|
|
fi
|
2023-09-12 11:23:20 +02:00
|
|
|
EOF
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2024-07-18 16:36:06 +02:00
|
|
|
WORKDIR /srv/faup/build
|
|
|
|
RUN cmake -G "Ninja" ../
|
|
|
|
RUN ninja
|
|
|
|
RUN ninja install
|
|
|
|
WORKDIR /srv/faup/src/lib/bindings/python
|
|
|
|
RUN pip wheel --no-cache-dir --no-dependencies -w /wheels/ .
|
|
|
|
|
|
|
|
WORKDIR /srv/
|
|
|
|
RUN rm -rf /srv/faup
|
|
|
|
|
|
|
|
|
|
|
|
FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
|
2023-06-15 13:55:16 +02:00
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
2023-09-17 13:37:02 +02:00
|
|
|
|
2023-05-16 16:26:20 +02:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
libglib2.0-0 \
|
|
|
|
libpoppler-cpp0v5 \
|
|
|
|
libgl1 \
|
2024-07-18 16:36:06 +02:00
|
|
|
libfuzzy2 \
|
|
|
|
libffi8 \
|
|
|
|
libxext6 \
|
|
|
|
libxml2 \
|
|
|
|
libxslt1.1 \
|
|
|
|
libzbar0 \
|
2019-11-28 19:30:53 +01:00
|
|
|
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
2024-07-18 16:36:06 +02:00
|
|
|
|
2023-06-15 13:55:16 +02:00
|
|
|
COPY --from=python-build /wheels /wheels
|
|
|
|
COPY --from=python-build /usr/local/lib/libfaupl* /usr/local/lib/
|
2024-07-18 16:54:57 +02:00
|
|
|
RUN ldconfig
|
|
|
|
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
|
2024-07-19 12:30:36 +02:00
|
|
|
RUN pip uninstall -y pip
|
2024-07-18 16:36:06 +02:00
|
|
|
|
2023-05-16 16:26:20 +02:00
|
|
|
# Since we compile faup ourselves and lua is not required anymore, we can load our own library
|
|
|
|
# and skip the pre-compiled blob to improve compatibility with other architectures like ARM
|
|
|
|
RUN sed -i s/LoadLibrary\(LOAD_LIB\)/LoadLibrary\(\"\\/usr\\/local\\/lib\\/libfaupl.so\"\)/ \
|
2024-07-18 16:36:06 +02:00
|
|
|
/usr/local/lib/python3.12/site-packages/pyfaup/__init__.py
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2023-05-16 16:26:20 +02:00
|
|
|
# Disable (all) warnings raised when using 'future'
|
|
|
|
RUN sed -i '/import sys/a import warnings\nwarnings.warn = lambda *args, **kwargs: None' \
|
2023-06-15 13:55:16 +02:00
|
|
|
/usr/local/bin/misp-modules
|
2023-04-13 16:02:02 +02:00
|
|
|
|
2023-05-16 16:26:20 +02:00
|
|
|
ENTRYPOINT [ "/usr/local/bin/misp-modules", "-l", "0.0.0.0"]
|