2022-09-15 19:35:42 +02:00
|
|
|
ARG DOCKER_HUB_PROXY=""
|
|
|
|
|
|
|
|
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye" as builder
|
2023-05-16 16:26:20 +02:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
ARG MODULES_TAG
|
|
|
|
ARG MODULES_COMMIT
|
|
|
|
|
|
|
|
# Install development environment
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
cmake \
|
|
|
|
git \
|
|
|
|
python3-dev \
|
|
|
|
python3-pip \
|
|
|
|
python3-wheel \
|
|
|
|
build-essential \
|
|
|
|
pkg-config \
|
|
|
|
libpoppler-cpp-dev \
|
|
|
|
libfuzzy-dev \
|
|
|
|
libssl-dev \
|
|
|
|
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2019-11-28 19:30:53 +01:00
|
|
|
RUN mkdir /wheel
|
2020-02-25 02:14:24 +01:00
|
|
|
WORKDIR /srv
|
|
|
|
|
2023-03-28 15:37:13 +02:00
|
|
|
RUN 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-05-16 16:26:20 +02:00
|
|
|
|
2023-04-13 16:02:02 +02:00
|
|
|
RUN cd /srv/misp-modules; \
|
|
|
|
echo "pyeti" >> REQUIREMENTS; \
|
|
|
|
echo "git+https://github.com/abenassi/Google-Search-API" >> REQUIREMENTS; \
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2022-09-15 19:35:42 +02:00
|
|
|
FROM "${DOCKER_HUB_PROXY}python:3.9-slim-bullseye"
|
2023-05-16 16:26:20 +02:00
|
|
|
|
|
|
|
# Install runtime environment
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
libglib2.0-0 \
|
|
|
|
libzbar0 \
|
|
|
|
libxrender1 \
|
|
|
|
libxext6 \
|
|
|
|
libpoppler-cpp0v5 \
|
|
|
|
libgl1 \
|
2019-11-28 19:30:53 +01:00
|
|
|
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
2023-05-16 16:26:20 +02:00
|
|
|
|
|
|
|
COPY --from=builder /wheel /wheel
|
|
|
|
COPY --from=builder /usr/local/lib/libfaupl* /usr/local/lib/
|
|
|
|
RUN pip install --use-deprecated=legacy-resolver /wheel/*.whl; ldconfig
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# Remove double logging configuration from 'apiosintDS'
|
|
|
|
RUN sed -i "/logging.basicConfig/d" \
|
|
|
|
/usr/local/lib/python3.9/site-packages/apiosintDS/apiosintDS.py; \
|
|
|
|
sed -i "/logging.basicConfig/d" \
|
|
|
|
/usr/local/lib/python3.9/site-packages/apiosintDS/modules/dosearch.py; \
|
|
|
|
sed -i "/logging.basicConfig/d" \
|
|
|
|
/usr/local/lib/python3.9/site-packages/apiosintDS/modules/listutils.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' \
|
|
|
|
/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"]
|