From 2f11e2aca73af6ee4fbb262ba37fd0016f2e5c88 Mon Sep 17 00:00:00 2001 From: tangramor Date: Thu, 18 Jan 2024 11:13:28 +0800 Subject: [PATCH 1/5] Update install.md for docker related updates add NPM_MIRROR option --- guide/install.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/guide/install.md b/guide/install.md index ed759e8d..971c37b4 100644 --- a/guide/install.md +++ b/guide/install.md @@ -77,15 +77,18 @@ docker run --name slidev --rm -it \ --user node \ -v ${PWD}:/slidev \ -p 3030:3030 \ + -e NPM_MIRROR="https://registry.npmmirror.com" \ tangramor/slidev:latest ``` +***Note***: You can use `NPM_MIRROR` to specify a npm mirror to speed up the installation process. + If your work folder is empty, it will generate a template `slides.md` and other related files under your work folder, and launch the server on port `3030`. -You can access your slides from `http://localhost:3030/` +You can access your slides from http://localhost:3030/ -### Build deployable image +## Build deployable image Or you can create your own slidev project to a docker image with Dockerfile: @@ -100,15 +103,14 @@ Create the docker image: `docker build -t myppt .` And run the container: `docker run --name myslides --rm --user node -p 3030:3030 myppt` -You can visit your slides from `http://localhost:3030/` +You can visit your slides from http://localhost:3030/ -### Build hostable SPA (Single Page Application) +## Build hostable SPA (Single Page Application) Run command `docker exec -i slidev npx slidev build` on the running container `slidev`. It will generate static HTML files under `dist` folder. - -#### Host on Github Pages +### Host on Github Pages You can host `dist` in a static web site such as [Github Pages](https://tangramor.github.io/slidev_docker/) or Gitlab Pages. @@ -117,7 +119,7 @@ Because in Github pages the url may contain subfolder, so you need to modify the And to avoid Jekyll build process, you need to add an empty file `.nojekyll`. -#### Host by docker +### Host by docker You can also host it by yourself with docker: @@ -131,6 +133,7 @@ Or create a static image with following Dockerfile: FROM nginx:alpine COPY dist /usr/share/nginx/html + ``` Create the docker image: `docker build -t mystaticppt .` From 5adb970a67e60078fd70c5d01b82fe89c493a7de Mon Sep 17 00:00:00 2001 From: tangramor Date: Thu, 18 Jan 2024 11:16:32 +0800 Subject: [PATCH 2/5] Update exporting.md for docker image Add Exportable docker image section --- guide/exporting.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guide/exporting.md b/guide/exporting.md index a3a2179d..a7835c8c 100644 --- a/guide/exporting.md +++ b/guide/exporting.md @@ -132,6 +132,24 @@ This command also accept multiple entries like for the [export command](#multipl See [Static Hosting](/guide/hosting). +## Exportable docker image + +To support the export feature, there is a bigger docker image with tag **playwright**. Just run following command in your work folder: + +```bash +docker run --name slidev -d --rm -it \ + -v ${PWD}:/slidev \ + -p 3030:3030 \ + -e NPM_MIRROR="https://registry.npmmirror.com" \ + tangramor/slidev:playwright +``` + +Then you can use the export feature like following under your work folder: + +```bash +docker exec -i slidev npx slidev export --timeout 2m --output slides.pdf +``` + ## Troubleshooting ### Timeout From 33ef8a1a66c6df694144cb085a82036cf7606025 Mon Sep 17 00:00:00 2001 From: tangramor Date: Thu, 18 Jan 2024 11:21:12 +0800 Subject: [PATCH 3/5] Update install.md to fix header marks --- guide/install.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guide/install.md b/guide/install.md index 971c37b4..2b689658 100644 --- a/guide/install.md +++ b/guide/install.md @@ -88,7 +88,7 @@ If your work folder is empty, it will generate a template `slides.md` and other You can access your slides from http://localhost:3030/ -## Build deployable image +### Build deployable image Or you can create your own slidev project to a docker image with Dockerfile: @@ -106,11 +106,11 @@ And run the container: `docker run --name myslides --rm --user node -p 3030:3030 You can visit your slides from http://localhost:3030/ -## Build hostable SPA (Single Page Application) +### Build hostable SPA (Single Page Application) Run command `docker exec -i slidev npx slidev build` on the running container `slidev`. It will generate static HTML files under `dist` folder. -### Host on Github Pages +#### Host on Github Pages You can host `dist` in a static web site such as [Github Pages](https://tangramor.github.io/slidev_docker/) or Gitlab Pages. @@ -119,7 +119,7 @@ Because in Github pages the url may contain subfolder, so you need to modify the And to avoid Jekyll build process, you need to add an empty file `.nojekyll`. -### Host by docker +#### Host by docker You can also host it by yourself with docker: From c4a2e55b29bf4071b0fee0ad3bdbd79213e07163 Mon Sep 17 00:00:00 2001 From: tangramor Date: Thu, 22 Feb 2024 10:37:07 +0800 Subject: [PATCH 4/5] Update exporting.md remove -d for docker export --- guide/exporting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/exporting.md b/guide/exporting.md index a7835c8c..c5f99e9c 100644 --- a/guide/exporting.md +++ b/guide/exporting.md @@ -137,7 +137,7 @@ See [Static Hosting](/guide/hosting). To support the export feature, there is a bigger docker image with tag **playwright**. Just run following command in your work folder: ```bash -docker run --name slidev -d --rm -it \ +docker run --name slidev --rm -it \ -v ${PWD}:/slidev \ -p 3030:3030 \ -e NPM_MIRROR="https://registry.npmmirror.com" \ From d1ce13837ec1f6f93be6b16d9f5682489ad6a7ed Mon Sep 17 00:00:00 2001 From: tangramor Date: Fri, 23 Feb 2024 11:04:51 +0800 Subject: [PATCH 5/5] Update install.md fix url --- guide/install.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guide/install.md b/guide/install.md index 4a436294..d30f19f3 100644 --- a/guide/install.md +++ b/guide/install.md @@ -77,7 +77,7 @@ docker run --name slidev --rm -it \ If your work folder is empty, it will generate a template `slides.md` and other related files under your work folder, and launch the server on port `3030`. -You can access your slides from http://localhost:3030/ +You can access your slides from `http://localhost:3030/` ### Build deployable image @@ -94,7 +94,7 @@ Create the docker image: `docker build -t myppt .` And run the container: `docker run --name myslides --rm --user node -p 3030:3030 myppt` -You can visit your slides from http://localhost:3030/ +You can visit your slides from `http://localhost:3030/` ### Build hostable SPA (Single Page Application)