Skip to content

Commit

Permalink
[DOP-4438]: Add rust installation
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Apr 2, 2024
1 parent 88e4cf3 commit e1fa743
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
18 changes: 16 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
25 changes: 22 additions & 3 deletions Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ export abstract class JobHandler {
const snootyFrontEndVars = {
GATSBY_BASE_URL: this._config.get<string>('gatsbyBaseUrl'),
PREVIEW_BUILD_ENABLED: this._config.get<string>('previewBuildEnabled'),
USE_FILTER_BRANCH: true,
GATSBY_TEST_SEARCH_UI: this._config.get<string>('featureFlagSearchUI'),
GATSBY_SHOW_CHATBOT: this._config.get<string>('gatsbyUseChatbot'),
GATSBY_HIDE_UNIFIED_FOOTER_LOCALE: this._config.get<string>('gatsbyHideUnifiedFooterLocale'),
Expand Down

0 comments on commit e1fa743

Please sign in to comment.