misp-docker/modules/Dockerfile

63 lines
2.6 KiB
Docker
Raw Normal View History

ARG DOCKER_HUB_PROXY=""
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye" as builder
2019-11-25 22:58:18 +01:00
ENV DEBIAN_FRONTEND noninteractive
ARG MODULES_TAG
2022-09-03 13:59:35 +02:00
ARG MODULES_COMMIT
2019-11-25 22:58:18 +01:00
RUN apt-get update && apt-get install -y --no-install-recommends \
2020-02-25 02:14:24 +01:00
cmake \
2019-11-25 22:58:18 +01:00
git \
python3-dev \
python3-pip \
2019-11-28 19:30:53 +01:00
python3-wheel \
2019-11-25 22:58:18 +01:00
build-essential \
pkg-config \
libpoppler-cpp-dev \
2020-01-28 20:21:33 +01:00
libfuzzy-dev \
2022-10-24 18:40:37 +02:00
libssl-dev \
2019-11-25 22:58:18 +01:00
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
2019-11-28 19:30:53 +01:00
# Build MISP Modules
RUN mkdir /wheel
2020-02-25 02:14:24 +01:00
WORKDIR /srv
2022-09-03 13:59:35 +02:00
RUN git clone --branch ${MODULES_TAG} --depth 1 https://github.com/MISP/misp-modules.git /srv/misp-modules
RUN if [ ! -z ${MODULES_COMMIT} ]; then cd /srv/misp-modules && git checkout ${MODULES_COMMIT}; fi; \
# Fixed in master - even though __init__.py is not mandatory in py3, wheels skip packages without it
touch /srv/misp-modules/misp_modules/modules/action_mod/_utils/__init__.py; \
# Fixed in master - missing dependencies
echo "Jinja2==3.1.2\nmattermostdriver==7.3.2" >> /srv/misp-modules/REQUIREMENTS; \
2022-01-05 18:25:27 +01:00
cd /srv/misp-modules || exit; sed -i 's/-e //g' REQUIREMENTS; pip3 wheel -r REQUIREMENTS --no-cache-dir -w /wheel/
2020-02-25 02:14:24 +01:00
RUN git clone --depth 1 https://github.com/stricaud/faup.git /srv/faup; \
cd /srv/faup/build || exit; cmake .. && make install; \
cd /srv/faup/src/lib/bindings/python || exit; pip3 wheel --no-cache-dir -w /wheel/ .
2019-11-25 22:58:18 +01:00
2021-06-16 18:22:56 +02:00
# Remove extra packages due to incompatible requirements.txt files
WORKDIR /wheel
RUN find . -name "chardet*" | grep -v "chardet-4.0.0" | xargs rm -f
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye"
2019-11-25 22:58:18 +01:00
2019-11-28 19:30:53 +01:00
RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libzbar0 \
libxrender1 \
libxext6 \
libpoppler-cpp0v5 \
2022-09-03 13:59:35 +02:00
libgl1 \
2019-11-28 19:30:53 +01:00
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
2019-11-25 22:58:18 +01:00
2019-11-28 19:30:53 +01:00
COPY --from=builder /wheel /wheel
2020-02-25 02:14:24 +01:00
COPY --from=builder /usr/local/lib/libfaupl* /usr/local/lib/
2020-12-15 17:51:22 +01:00
RUN pip install --use-deprecated=legacy-resolver /wheel/*.whl; ldconfig
2019-11-25 22:58:18 +01:00
2022-09-03 13:59:35 +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\"\)/ \
/usr/local/lib/python3.9/site-packages/pyfaup/__init__.py
2019-11-25 22:58:18 +01:00
ENTRYPOINT [ "/usr/local/bin/misp-modules", "-l", "0.0.0.0"]