From e1fa74363b9ec70289a58ec215a88a13c50339cc Mon Sep 17 00:00:00 2001 From: branberry Date: Tue, 2 Apr 2024 13:11:42 -0500 Subject: [PATCH] [DOP-4438]: Add rust installation --- Dockerfile | 18 ++++++++++++++++-- Dockerfile.local | 25 ++++++++++++++++++++++--- src/job/jobHandler.ts | 1 + 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6dac4a5a5..aedf1b796 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,17 +63,31 @@ USER docsworker-xlarge WORKDIR ${WORK_DIRECTORY} +# Get Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + +RUN chmod -R 777 ${WORK_DIRECTORY}/.cargo/bin + +ENV PATH="${WORK_DIRECTORY}/.cargo/bin:${PATH}" +RUN echo ${WORK_DIRECTORY} + # get shared.mk RUN curl https://raw.githubusercontent.com/mongodb/docs-worker-pool/meta/makefiles/shared.mk -o shared.mk # install snooty frontend and docs-tools -RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \ +# RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \ +RUN git clone -b main --depth 1 https://github.com/mongodb/snooty.git \ && cd snooty \ && npm ci --legacy-peer-deps --omit=dev \ && git clone --depth 1 https://github.com/mongodb/docs-tools.git \ && mkdir -p ./static/images \ && mv ./docs-tools/themes/mongodb/static ./static/docs-tools \ - && mv ./docs-tools/themes/guides/static/images/bg-accent.svg ./static/docs-tools/images/bg-accent.svg + && mv ./docs-tools/themes/guides/static/images/bg-accent.svg ./static/docs-tools/images/bg-accent.svg \ + && cd component-factory-transformer \ + && cargo build \ + && rustup target add wasm32-wasi \ + && npm run prepublishOnly + # install redoc fork RUN git clone -b @dop/redoc-cli@${REDOC_CLI_VERSION} --depth 1 https://github.com/mongodb-forks/redoc.git redoc \ diff --git a/Dockerfile.local b/Dockerfile.local index 4382caf4d..fccd9d3e0 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -24,6 +24,8 @@ RUN apt-get install --yes build-essential RUN apt-get install --yes python3-pip libxml2-dev libxslt-dev python-dev pkg-config + + RUN python3 -m pip install poetry # install snooty parser @@ -43,16 +45,33 @@ RUN git clone -b v${MUT_VERSION} --depth 1 https://github.com/mongodb/mut.git \ ENV PATH="${PATH}:/opt/snooty:/opt/mut:/${WORK_DIRECTORY}/.local/bin" + + # setup user and root directory RUN useradd -ms /bin/bash docsworker-xlarge RUN chmod 755 -R ${WORK_DIRECTORY} RUN chown -Rv docsworker-xlarge ${WORK_DIRECTORY} + USER docsworker-xlarge +# Get Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + +RUN chmod -R 777 ${WORK_DIRECTORY}/.cargo/bin + +ENV PATH="${WORK_DIRECTORY}/.cargo/bin:${PATH}" +RUN echo ${WORK_DIRECTORY} + + # install snooty frontend and docs-tools -RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \ +# RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \ +RUN git clone -b main --depth 1 https://github.com/mongodb/snooty.git \ && cd snooty \ - && npm ci --legacy-peer-deps --omit=dev + && npm ci --legacy-peer-deps --omit=dev \ + && cd component-factory-transformer \ + && cargo build \ + && rustup target add wasm32-wasi \ + && npm run prepublishOnly RUN curl https://raw.githubusercontent.com/mongodb/docs-worker-pool/meta/makefiles/shared.mk -o shared.mk @@ -61,7 +80,7 @@ RUN git clone -b @dop/redoc-cli@${REDOC_CLI_VERSION} --depth 1 https://github.co # Install dependencies for Redoc CLI && cd redoc/ \ && npm ci --prefix cli/ --omit=dev - + FROM initial as persistence RUN mkdir -p modules/persistence && chmod 755 modules/persistence diff --git a/src/job/jobHandler.ts b/src/job/jobHandler.ts index dbd9b6718..d7700ee60 100644 --- a/src/job/jobHandler.ts +++ b/src/job/jobHandler.ts @@ -403,6 +403,7 @@ export abstract class JobHandler { const snootyFrontEndVars = { GATSBY_BASE_URL: this._config.get('gatsbyBaseUrl'), PREVIEW_BUILD_ENABLED: this._config.get('previewBuildEnabled'), + USE_FILTER_BRANCH: true, GATSBY_TEST_SEARCH_UI: this._config.get('featureFlagSearchUI'), GATSBY_SHOW_CHATBOT: this._config.get('gatsbyUseChatbot'), GATSBY_HIDE_UNIFIED_FOOTER_LOCALE: this._config.get('gatsbyHideUnifiedFooterLocale'),