Skip to content

Commit

Permalink
Merge pull request #1722 from marcellodesales/feature/dockerized-docs…
Browse files Browse the repository at this point in the history
…-support

🐛 fix plugins.md formatting for docs with dockerized docs validation
  • Loading branch information
madjin authored Jan 4, 2025
2 parents 3b36e79 + 790e6e1 commit ee79ef2
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
58 changes: 58 additions & 0 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# syntax=docker/dockerfile:1

## Modified version of https://docusaurus.community/knowledge/deployment/docker/

# Stage 1: Base image.
## Start with a base image containing NodeJS so we can build Docusaurus.
FROM node:23.3.0-slim AS base
## Disable colour output from yarn to make logs easier to read.

## https://pnpm.io/docker
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

ENV FORCE_COLOR=0
## Enable corepack.
RUN corepack enable
## Set the working directory to `/opt/docusaurus`.
WORKDIR /opt/docusaurus

## Required by docusaurus: [ERROR] Loading of version failed for version current
RUN apt-get update && apt-get install -y git

FROM base AS dev
## Set the working directory to `/opt/docusaurus`.
WORKDIR /opt/docusaurus
## Expose the port that Docusaurus will run on.
EXPOSE 3000
## Run the development server.
CMD [ -d "node_modules" ] && npm run start -- --host 0.0.0.0 --poll 1000 || pnpm install && pnpm run start -- --host 0.0.0.0 --poll 1000

# Stage 2b: Production build mode.
FROM base AS prod
## Set the working directory to `/opt/docusaurus`.
WORKDIR /opt/docusaurus

COPY docs/package.json /opt/docusaurus/package.json
COPY docs/package-lock.json /opt/docusaurus/package-lock.json

## Install dependencies with `--immutable` to ensure reproducibility.
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install

## Copy over the source code.
COPY docs/ /opt/docusaurus/
COPY packages/ /opt/packages/

## Required buy docusaurus [ERROR] Loading of version failed for version current
COPY .git/ /opt/.git/

# Build from sources
RUN pnpm run build

# Stage 3a: Serve with `docusaurus serve`.
FROM prod AS serve
## Expose the port that Docusaurus will run on.
EXPOSE 3000
## Run the production server.
CMD ["npm", "run", "serve", "--", "--host", "0.0.0.0", "--no-open"]

9 changes: 9 additions & 0 deletions docker-compose-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
docs:
build:
dockerfile: Dockerfile.docs
context: .
target: serve
ports:
- 3000:3000

10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,13 @@ Tests are written using Jest and can be found in `src/**/*.test.ts` files. The t
- Run tests in sequence (--runInBand)

To create new tests, add a `.test.ts` file adjacent to the code you're testing.

## Docs Updates

Please make sure to vetify if the documentation provided is correct. In order to do so, please run the docs service.

```console
docker compose -f docker-compose-docs.yaml up --build
```

The docusaurus server will get started and you can verify it locally at https://localhost:3000/eliza.
8 changes: 4 additions & 4 deletions docs/docs/packages/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,12 @@ The Fuel plugin provides an interface to the Fuel Ignition blockchain.
**Actions:**

1. `TRANSFER_FUEL_ETH` - Transfer ETH to a given Fuel address. - **Inputs**: - `toAddress` (string): The Fuel address to transfer ETH to. - `amount` (string): The amount of ETH to transfer. - **Outputs**: Confirmation message with transaction details. - **Example**:
`json
{
```json
{
"toAddress": "0x8F8afB12402C9a4bD9678Bec363E51360142f8443FB171655eEd55dB298828D1",
"amount": "0.00001"
}
`
}
```
**Setup and Configuration:**

1. **Configure the Plugin**
Expand Down
3 changes: 3 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "eliza-docs",
"version": "0.1.7-alpha.2",
"private": true,
"packageManager": "[email protected]",
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start --no-open",
Expand All @@ -21,9 +22,11 @@
"@docusaurus/plugin-ideal-image": "3.6.3",
"@docusaurus/preset-classic": "3.6.3",
"@docusaurus/theme-mermaid": "3.6.3",
"@docusaurus/theme-common": "3.6.3",
"@mdx-js/react": "3.0.1",
"clsx": "2.1.1",
"docusaurus-lunr-search": "3.5.0",
"lunr": "2.3.9",
"dotenv": "^16.4.7",
"prism-react-renderer": "2.3.1",
"react": "18.3.1",
Expand Down

0 comments on commit ee79ef2

Please sign in to comment.