Skip to content

Commit

Permalink
docs: fix librarium container (#5228)
Browse files Browse the repository at this point in the history
* docs: fix librarium container

* chore: fix behavior

* chore: add env variables to the dockerfile

---------

Co-authored-by: Karl Cardenas <[email protected]>
(cherry picked from commit 179a933)
  • Loading branch information
caroldelwing committed Jan 3, 2025
1 parent bd2b3bf commit 6760a20
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ screenshots/
tests/screenshot.spec.ts-snapshots/
tests-results/
playwright-report/
.docusaurus/
.git
.github
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ src/deprecated
vale/
**/*.yaml
**/*.yml
.dockerignore

docs/api-content/**/*.json

Expand Down
22 changes: 14 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -183,8 +183,8 @@ commit: ## Add a Git commit. Usage: make commit MESSAGE="<your message here>"
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
Expand Down Expand Up @@ -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
algolia index delete dev-docusaurus-librarium --confirm
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<your-palette-api-key>` 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 `<your-palette-api-key>` with
your Palette API key.

```shell
PALETTE_API_KEY="<your-palette-api-key>"
DISABLE_PACKS_INTEGRATIONS=false
```

> [!IMPORTANT] You need a Palette API key to start the local development server. Refer to the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6760a20

Please sign in to comment.