Skip to content

Commit 9c3bba8

Browse files
committed
initial commit
0 parents  commit 9c3bba8

File tree

5 files changed

+98
-0
lines changed

5 files changed

+98
-0
lines changed

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:17-alpine3.15
2+
3+
COPY entrypoint.sh /
4+
5+
WORKDIR /slidev
6+
7+
RUN npm config set registry https://registry.npm.taobao.org &&\
8+
# npm i -g @slidev/cli @slidev/theme-default @slidev/theme-seriph &&\
9+
chmod +x /entrypoint.sh
10+
11+
ENTRYPOINT [ "/entrypoint.sh" ]

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Slidev Docker image
2+
3+
work with [Slidev](https://sli.dev/). Just run following command in your work folder:
4+
5+
```bash
6+
docker run --name slidev --rm -it \
7+
--user node \
8+
-v ${PWD}:/slidev \
9+
-p 3030:3030 \
10+
tangramor/slidev:latest
11+
```
12+
13+
If your work folder is empty, it will generate an template `slides.md` and other related files under your work folder, and launch the server on port `3030`.
14+
15+
You can access your slides from http://localhost:3030/
16+
17+
18+
## Build deployable image
19+
20+
Or you can create your own slidev project to a docker image with Dockerfile:
21+
22+
```Dockerfile
23+
FROM tangramor/slidev:latest
24+
25+
ADD . /slidev
26+
27+
```
28+
29+
Create the docker image: `docker build -t myppt .`.
30+
31+
And run the container: `docker run --name myslides --rm --user node -p 3030:3030 myppt`
32+
33+
You can visit your slids from http://localhost:3030/
34+
35+
36+
## Build hostable SPA (Single Page Application)
37+
38+
Run command `docker exec -i slidev npx slidev build` on the runing container `slidev`. It will generate static HTML files under `dist` folder.
39+
40+
You can host `dist` in a static web site such as Github pages or Gitlab pages. You can also host it by your self:
41+
42+
```bash
43+
docker run --name myslides --rm -p 80:80 -v ${PWD}/dist:/usr/share/nginx/html nginx:alpine
44+
```
45+
46+
Or create a static image with following Dockerfile:
47+
48+
```Dockerfile
49+
FROM nginx:alpine
50+
51+
COPY dist /usr/share/nginx/html
52+
53+
```
54+
55+
Create the docker image: `docker build -t mystaticppt .`.
56+
57+
And run the container: `docker run --name myslides --rm -p 80:80 mystaticppt`
58+
59+
You can visit your slids from http://localhost/

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker build -t tangramor/slidev .

docker_run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
docker run --name slidev -d --rm -it \
4+
--user node \
5+
-v ${PWD}:/slidev \
6+
-p 3030:3030 \
7+
tangramor/slidev:latest

entrypoint.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
npm config set registry https://registry.npm.taobao.org
4+
5+
if [ -f /slidev/slides.md ]; then
6+
if [ -d /slidev/node_modules ]; then
7+
npm update
8+
else
9+
npm install
10+
fi
11+
echo "Start slidev..."
12+
npx slidev --remote
13+
else
14+
echo "slides.md not found in the bind mount to /slidev"
15+
npm install @slidev/cli @slidev/theme-default @slidev/theme-seriph
16+
cp -f /slidev/node_modules/@slidev/cli/template.md /slidev/slides.md
17+
npx slidev --remote
18+
fi

0 commit comments

Comments
 (0)