Skip to content

Commit e9cccdb

Browse files
authored
feat: update install.md to fix the missed docker part (#57)
1 parent 61b06f2 commit e9cccdb

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

guide/install.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,67 @@ This command will also try to use local `@slidev/cli` if it has been found in th
6262

6363
## Install on Docker
6464

65-
If you need a rapid way to run a presentation with containers, you can use the prebuilt [docker](https://hub.docker.com/r/stig124/slidev) image maintained by [stig124](https://github.com/Stig124), or build your own.
65+
If you need a rapid way to run a presentation with containers, you can use the prebuilt [docker](https://hub.docker.com/r/tangramor/slidev) image maintained by [tangramor](https://github.com/tangramor), or build your own.
6666

67-
Refer to the [slidevjs/container repo](https://github.com/slidevjs/container) for more details.
67+
Just run following command in your work folder:
68+
69+
```bash
70+
docker run --name slidev --rm -it \
71+
--user node \
72+
-v ${PWD}:/slidev \
73+
-p 3030:3030 \
74+
tangramor/slidev:latest
75+
```
76+
77+
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`.
78+
79+
You can access your slides from http://localhost:3030/
80+
81+
82+
### Build deployable image
83+
84+
Or you can create your own slidev project to a docker image with Dockerfile:
85+
86+
```Dockerfile
87+
FROM tangramor/slidev:latest
88+
89+
ADD . /slidev
90+
91+
```
92+
93+
Create the docker image: `docker build -t myppt .`
94+
95+
And run the container: `docker run --name myslides --rm --user node -p 3030:3030 myppt`
96+
97+
You can visit your slides from http://localhost:3030/
98+
99+
100+
### Build hostable SPA (Single Page Application)
101+
102+
Run command `docker exec -i slidev npx slidev build` on the running container `slidev`. It will generate static HTML files under `dist` folder.
103+
104+
You can host `dist` in a static web site such as [Github pages](https://tangramor.github.io/slidev_docker/) or Gitlab pages. Because in Github pages the url may contain subfolder, so you need to modify the generated `index.html` to change `href="/assets/xxx` to `href="./assets/xxx`. And to avoid Jekyll build process, you need to add an empty file `.nojekyll`.
105+
106+
You can also host it by yourself:
107+
108+
```bash
109+
docker run --name myslides --rm -p 80:80 -v ${PWD}/dist:/usr/share/nginx/html nginx:alpine
110+
```
111+
112+
Or create a static image with following Dockerfile:
113+
114+
```Dockerfile
115+
FROM nginx:alpine
116+
117+
COPY dist /usr/share/nginx/html
118+
119+
```
120+
121+
Create the docker image: `docker build -t mystaticppt .`
122+
123+
And run the container: `docker run --name myslides --rm -p 80:80 mystaticppt`
124+
125+
You can visit your slids from http://localhost/
126+
127+
128+
Refer to the [tangramor/slidev_docker](https://github.com/tangramor/slidev_docker) for more details.

0 commit comments

Comments
 (0)