You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/install.md
+63-2Lines changed: 63 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,67 @@ This command will also try to use local `@slidev/cli` if it has been found in th
62
62
63
63
## Install on Docker
64
64
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.
66
66
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