From 0051fbe8eb3836fc34d2b253469ffc18f14597b4 Mon Sep 17 00:00:00 2001 From: YangGuanZhe Date: Tue, 19 Nov 2024 19:50:09 +0800 Subject: [PATCH] Fix dockerfile cmd for npm and pnpm --- docs/deployment/docker/_partials/_dockerfile-npm.mdx | 2 +- docs/deployment/docker/_partials/_dockerfile-pnpm.mdx | 4 ++-- docs/deployment/docker/index.mdx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/deployment/docker/_partials/_dockerfile-npm.mdx b/docs/deployment/docker/_partials/_dockerfile-npm.mdx index 15e7bdc..0c03b11 100644 --- a/docs/deployment/docker/_partials/_dockerfile-npm.mdx +++ b/docs/deployment/docker/_partials/_dockerfile-npm.mdx @@ -18,7 +18,7 @@ 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 || npm run install && npm run start --host 0.0.0.0 --poll 1000 +CMD [ -d "node_modules" ] && npm run start -- --host 0.0.0.0 --poll 1000 || npm install && npm run start -- --host 0.0.0.0 --poll 1000 # Stage 2b: Production build mode. FROM base as prod diff --git a/docs/deployment/docker/_partials/_dockerfile-pnpm.mdx b/docs/deployment/docker/_partials/_dockerfile-pnpm.mdx index 315c3c4..2067e2c 100644 --- a/docs/deployment/docker/_partials/_dockerfile-pnpm.mdx +++ b/docs/deployment/docker/_partials/_dockerfile-pnpm.mdx @@ -18,7 +18,7 @@ WORKDIR /opt/docusaurus ## Expose the port that Docusaurus will run on. EXPOSE 3000 ## Run the development server. -CMD [ -d "node_modules" ] && pnpm start --host 0.0.0.0 --poll 1000 || pnpm install && pnpm start --host 0.0.0.0 --poll 1000 +CMD [ -d "node_modules" ] && pnpm start -- --host 0.0.0.0 --poll 1000 || pnpm install && pnpm start -- --host 0.0.0.0 --poll 1000 # Stage 2b: Production build mode. FROM base as prod @@ -36,7 +36,7 @@ FROM prod as serve ## Expose the port that Docusaurus will run on. EXPOSE 3000 ## Run the production server. -CMD ["pnpm", "serve", "--host", "0.0.0.0", "--no-open"] +CMD ["pnpm", "serve", "--", "--host", "0.0.0.0", "--no-open"] # Stage 3b: Serve with Caddy. FROM caddy:2-alpine as caddy diff --git a/docs/deployment/docker/index.mdx b/docs/deployment/docker/index.mdx index 1c72fd8..150b7f7 100644 --- a/docs/deployment/docker/index.mdx +++ b/docs/deployment/docker/index.mdx @@ -117,7 +117,7 @@ Depending on stage / target you will need to run the docker image differently. To run the `dev` target you will need to run the following command: ```bash - docker run --rm -d -p 3000:3000 -v $(pwd):/var/docusaurus + docker run --rm -d -p 3000:3000 -v $(pwd):/opt/docusaurus ``` If using PowerShell you will need to use `${pwd}` instead of `$(pwd)`. On some systems you may need to replace `$(pwd)` with `.` or the full path to the directory you want to mount.