From 179a933ef17a2b928c69d8d0debb6074147de124 Mon Sep 17 00:00:00 2001 From: caroldelwing Date: Fri, 3 Jan 2025 17:26:32 -0300 Subject: [PATCH] docs: fix librarium container (#5228) * docs: fix librarium container * chore: fix behavior * chore: add env variables to the dockerfile --------- Co-authored-by: Karl Cardenas --- .dockerignore | 3 +++ .prettierignore | 1 + Dockerfile | 22 ++++++++++++++-------- Makefile | 10 +++++----- README.md | 5 ++++- package.json | 2 +- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index a2e0abb3d8..a74fd849c2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,3 +9,6 @@ screenshots/ tests/screenshot.spec.ts-snapshots/ tests-results/ playwright-report/ +.docusaurus/ +.git +.github \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 462ae7b456..9ae3624be4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,6 +6,7 @@ src/deprecated vale/ **/*.yaml **/*.yml +.dockerignore docs/api-content/**/*.json diff --git a/Dockerfile b/Dockerfile index 58d1d8a6f2..17a3b1b952 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,21 @@ FROM node:20-alpine WORKDIR /librarium -COPY ./scripts/entry.sh /entry.sh +ENV DISABLE_PACKS_INTEGRATIONS=true +ENV DISABLE_SECURITY_INTEGRATIONS=true + COPY --chown=node . . -RUN apk add util-linux && \ -chmod +x /entry.sh && \ -mkdir .cache && \ -npm ci && \ -chown -R node:node /librarium + +RUN apk add --no-cache util-linux bash && \ + npm install @docusaurus/faster &&\ + npm ci && \ + chmod -R +x scripts + + +RUN chown -R node:node /librarium + EXPOSE 9000 USER node -ENTRYPOINT ["/entry.sh"] -CMD ["npm", "run", "start"] + +CMD ["npm","run","start"] diff --git a/Makefile b/Makefile index c8ee8db46e..6591faae2a 100644 --- a/Makefile +++ b/Makefile @@ -85,11 +85,11 @@ init: ## Initialize npm dependencies grep -q "^ALGOLIA_APP_ID=" .env || echo "\nALGOLIA_APP_ID=1234567890" >> .env grep -q "^ALGOLIA_SEARCH_KEY=" .env || echo "\nALGOLIA_SEARCH_KEY=1234567890" >> .env grep -q "^ALGOLIA_INDEX_NAME=" .env || echo "\nALGOLIA_INDEX_NAME=spectrocloud" >> .env + grep -q "^DSO_AUTH_TOKEN=" .env || echo "\nDISABLE_SECURITY_INTEGRATIONS=true" >> .env + grep -q "^PALETTE_API_KEY=" .env || echo "\nDISABLE_PACKS_INTEGRATIONS=true" >> .env npx husky install start: ## Start a local development server - make generate-partials - npm run cves npm run start start-cached-packs: ## Start a local development server with cached packs retry. @@ -183,8 +183,8 @@ commit: ## Add a Git commit. Usage: make commit MESSAGE="" docker-image: ## Build the docker image docker build -t $(IMAGE) . -docker-start: docker-image ## Start a local development container - docker run --env-file=.env --rm -it -v $(CURDIR)/docs:/librarium/docs/ -p 9000:9000 $(IMAGE) +docker-start: docker-image ## Build the docker image and start a local development container + docker run --env-file=.env --rm -it -v $(CURDIR)/docs:/librarium/docs/ -v $(CURDIR)/_partials/:/librarium/_partials/ -p 9000:9000 $(IMAGE) ##@ Writing Checks @@ -296,4 +296,4 @@ update-dev-index: ## Update the Algolia index for the dev environment remove-dev-index: ## Remove the Algolia index for the dev environment @echo "removing Algolia index for dev environment" - algolia index delete dev-docusaurus-librarium --confirm \ No newline at end of file + algolia index delete dev-docusaurus-librarium --confirm diff --git a/README.md b/README.md index a1793563c4..284c964fe3 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,13 @@ Initialize the repository by issuing the following command: make init ``` -Next, add your Palette API key to the `.env` file. Replace `` with your Palette API key. +By default, the [Packs component](#packs-component) will be disabled. If you would like to enable it, then add your +Palette API key and the variable that enables the component to the `.env` file. Replace `` with +your Palette API key. ```shell PALETTE_API_KEY="" +DISABLE_PACKS_INTEGRATIONS=false ``` > [!IMPORTANT] You need a Palette API key to start the local development server. Refer to the diff --git a/package.json b/package.json index c97b764375..23b288cda4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "docusaurus": "docusaurus", - "start": "docusaurus start --host 0.0.0.0 --port 9000", + "start": "npm run cves && npm run generate-partials && docusaurus start --host 0.0.0.0 --port 9000", "build": "npm run generate-api-docs && npm run cves && npm run generate-partials && docusaurus build", "swizzle": "docusaurus swizzle", "cves": "node utils/cves/index.js",