From e8ce483da42bc86cfa5d8f0467b28d8ef6f00615 Mon Sep 17 00:00:00 2001 From: doug Date: Tue, 8 Nov 2022 16:32:19 -0500 Subject: [PATCH 1/2] FEATURE: Improve local copy of docs in SOC Security-Onion-Solutions/securityonion#9097 --- Dockerfile | 21 ++++++++++++++------- html/index.html | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75ae69f5..0ab74320 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,20 @@ FROM ghcr.io/security-onion-solutions/golang:alpine as builder ARG VERSION=0.0.0 -RUN apk update && apk add libpcap-dev bash git musl-dev gcc npm python3 py3-pip +RUN apk update && apk add libpcap-dev bash git musl-dev gcc npm python3 py3-pip py3-virtualenv COPY . /build WORKDIR /build +RUN mkdir gitdocs && cd gitdocs && \ + git clone --no-single-branch --depth 50 https://github.com/Security-Onion-Solutions/securityonion-docs.git . && \ + bash -c "[[ $VERSION == '0.0.0' ]]" || git checkout --force origin/$(echo $VERSION | cut -d'.' -f1,2) && \ + git clean -d -f -f && \ + sed -i "s|'display_github': True|'display_github': False|g" conf.py && \ + python3 -mvirtualenv /tmp/virtualenv && \ + /tmp/virtualenv/bin/python -m pip install --upgrade --no-cache-dir pip "setuptools<58.3.0" && \ + /tmp/virtualenv/bin/python -m pip install --upgrade --no-cache-dir pillow "mock==1.0.1" "alabaster>=0.7,<0.8,!=0.7.5" "commonmark==0.9.1" "recommonmark==0.5.0" "sphinx<2" "sphinx-rtd-theme<0.5" "readthedocs-sphinx-ext<2.2" "jinja2<3.1.0" && \ + /tmp/virtualenv/bin/python -m pip install --exists-action=w --no-cache-dir -r requirements.txt && \ + for i in /tmp/virtualenv/lib/python*/site-packages/sphinx_rtd_theme/versions.html; do echo > $i; done && \ + /tmp/virtualenv/bin/python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html RUN npm install jest jest-environment-jsdom --global RUN ln -s /usr/bin/python3 /usr/bin/python RUN ./build.sh "$VERSION" @@ -39,6 +50,7 @@ COPY --from=builder /build/COPYING . COPY --from=builder /build/LICENSE . COPY --from=builder /build/README.md . COPY --from=builder /build/sensoroni.json . +COPY --from=builder /build/gitdocs/_build/html ./html/docs RUN find html/js -name "*test*.js" -delete RUN chmod u+x scripts/* RUN chown 939:939 scripts/* @@ -62,12 +74,7 @@ RUN bash -c "[[ $WAZUH_VERSION == '0.0.0' ]]" || \ wget https://packages.wazuh.com/3.x/windows/wazuh-agent-$(echo $WAZUH_VERSION).msi -P html/downloads/) RUN bash -c "[[ $VERSION == '0.0.0' ]]" || \ - (wget https://docs.securityonion.net/_/downloads/en/$(echo $VERSION | cut -d'.' -f 1,2)/htmlzip/ -O /tmp/docs.zip && \ - unzip -o /tmp/docs.zip -d html/docs && \ - rm -f /tmp/docs.zip && \ - mv -f html/docs/securityonion-*/* html/docs && \ - rm -fr html/docs/securityonion-* && \ - wget https://github.com/Security-Onion-Solutions/securityonion-docs/raw/$(echo $VERSION | cut -d'.' -f 1,2)/images/cheat-sheet/Security-Onion-Cheat-Sheet.pdf -O html/docs/cheatsheet.pdf) + wget https://github.com/Security-Onion-Solutions/securityonion-docs/raw/$(echo $VERSION | cut -d'.' -f 1,2)/images/cheat-sheet/Security-Onion-Cheat-Sheet.pdf -O html/docs/cheatsheet.pdf ENV ELASTIC_VERSION=$ELASTIC_VERSION ENV WAZUH_VERSION=$WAZUH_VERSION diff --git a/html/index.html b/html/index.html index 7629877e..6692453d 100644 --- a/html/index.html +++ b/html/index.html @@ -226,7 +226,7 @@ {{ errorMessage }}
{{ i18n.errorHelp }} - + fa-life-ring
From 3d134b744e24d119500c032307bea3b080d814d5 Mon Sep 17 00:00:00 2001 From: Doug Burks Date: Fri, 11 Nov 2022 12:28:37 -0500 Subject: [PATCH 2/2] Remove leading slash from help.html since docsUrl already has trailing slash --- html/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/index.html b/html/index.html index 6692453d..3eef5101 100644 --- a/html/index.html +++ b/html/index.html @@ -226,7 +226,7 @@ {{ errorMessage }}
{{ i18n.errorHelp }} - + fa-life-ring