forked from Anduin2017/HowToCook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-with-docker.sh
More file actions
executable file
·48 lines (39 loc) · 1.13 KB
/
Copy pathrun-with-docker.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
node_image=node:22-alpine
python_image=python:3.11
listen_port=8000
# npm builld
docker run --rm -it \
-v $(pwd):/app \
-w /app \
--entrypoint /bin/sh \
$node_image -c """
npm install --loglevel verbose
npm run build
npm run lint
"""
# mkdocs build
echo """
FROM $python_image
ENV PIP_INDEX_URL=https://repo.huaweicloud.com/repository/pypi/simple
RUN sed -i 's/deb.debian.org/mirrors.huaweicloud.com/g' /etc/apt/sources.list.d/*.sources \
&& sed -i 's/security.debian.org/mirrors.huaweicloud.com/g' /etc/apt/sources.list.d/*.sources
RUN apt-get update && apt-get install -y weasyprint fonts-noto-cjk wget unzip
RUN pip install mkdocs
COPY requirements.txt ./
RUN pip install -r requirements.txt
""" >/tmp/Dockerfile.mkdocs
docker build . -f /tmp/Dockerfile.mkdocs -t mkdocs-env
docker run --rm -it \
-v $(pwd):/src \
-w /app \
-p $listen_port:8000 \
--entrypoint /bin/bash \
mkdocs-env -c """
for file in \$(ls /src); do
if [ \$file != "site" -a \$file != "node_modules" ]; then # folder to ignore for mkdocs build
ln -s /src/\$file /app/\$file
fi
done
mkdocs serve -a 0.0.0.0:8000
"""