Migrate docs to mdpress

This commit is contained in:
yeasy
2026-03-24 21:25:04 -07:00
parent 4f22d87afc
commit 793cc64738
4 changed files with 23 additions and 21 deletions

View File

@@ -20,14 +20,14 @@ jobs:
node-version: 20 node-version: 20
- name: Install docs dependencies - name: Install docs dependencies
run: npm install run: npm install
- name: Build Gitbook - name: Build mdPress site
run: npm run honkit:build run: npm run build
- name: Build Gitbook Docker Image - name: Build mdPress Docker Image
if: github.repository == 'docker-practice/docker_practice' if: github.repository == 'docker-practice/docker_practice'
run: | run: |
sudo chmod -R 777 _book sudo chmod -R 777 _site
echo "FROM nginx:alpine" >> Dockerfile echo "FROM nginx:alpine" >> Dockerfile
echo "COPY _book /usr/share/nginx/html" >> Dockerfile echo "COPY _site /usr/share/nginx/html" >> Dockerfile
echo "COPY .docker/docker-entrypoint.sh /" >> Dockerfile echo "COPY .docker/docker-entrypoint.sh /" >> Dockerfile
echo "ENTRYPOINT [\"/docker-entrypoint.sh\"]" >> Dockerfile echo "ENTRYPOINT [\"/docker-entrypoint.sh\"]" >> Dockerfile
@@ -35,7 +35,7 @@ jobs:
docker build \ docker build \
-t dockerpracticesig/docker_practice \ -t dockerpracticesig/docker_practice \
-t dockerpracticesig/docker_practice:gitbook \ -t dockerpracticesig/docker_practice:mdpress \
--label org.opencontainers.image.revision=$VCS_REF \ --label org.opencontainers.image.revision=$VCS_REF \
--label org.opencontainers.image.source="https://github.com/yeasy/docker_practice" \ --label org.opencontainers.image.source="https://github.com/yeasy/docker_practice" \
--label maintainer="https://github.com/docker-practice" \ --label maintainer="https://github.com/docker-practice" \
@@ -51,11 +51,11 @@ jobs:
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push dockerpracticesig/docker_practice docker push dockerpracticesig/docker_practice
docker push dockerpracticesig/docker_practice:gitbook docker push dockerpracticesig/docker_practice:mdpress
env: env:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}} DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
- name: Upload Gitbook dist - name: Upload mdPress dist
uses: docker://pcit/pages uses: docker://pcit/pages
if: github.repository == 'docker-practice/docker_practice' if: github.repository == 'docker-practice/docker_practice'
env: env:
@@ -63,7 +63,7 @@ jobs:
PCIT_GIT_TOKEN: ${{ secrets.PCIT_GIT_TOKEN }} PCIT_GIT_TOKEN: ${{ secrets.PCIT_GIT_TOKEN }}
PCIT_GIT_URL: github.com/docker-practice/zh-cn PCIT_GIT_URL: github.com/docker-practice/zh-cn
PCIT_KEEP_HISTORY: "true" PCIT_KEEP_HISTORY: "true"
PCIT_LOCAL_DIR: _book PCIT_LOCAL_DIR: _site
PCIT_MESSAGE: Build from yeasy/docker_practice@${{github.sha}} PCIT_MESSAGE: Build from yeasy/docker_practice@${{github.sha}}
PCIT_TARGET_BRANCH: master PCIT_TARGET_BRANCH: master
PCIT_USERNAME: khs1994 PCIT_USERNAME: khs1994

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
*.tmp *.tmp
.idea/ .idea/
_book/ _book/
_site*
format_report.txt format_report.txt
*.swp *.swp
*.edx *.edx

View File

@@ -2,29 +2,29 @@ version: "3"
services: services:
gitbook-build: mdpress-build:
&gitbook-build &mdpress-build
image: yeasy/docker_practice:latest image: yeasy/docker_practice:latest
volumes: volumes:
- ./:/srv/gitbook-src - ./:/srv/gitbook-src
command: build command: build
gitbook-server: mdpress-server:
<< : *gitbook-build << : *mdpress-build
ports: ports:
- 4000:4000 - 4000:4000
command: server command: server
# docker run -it --rm -p 4000:80 dockerpracticesig/docker_practice # docker run -it --rm -p 4000:80 dockerpracticesig/docker_practice
gitbook-offline: mdpress-offline:
&gitbook-offline &mdpress-offline
# this image build by GitHub Action # this image build by GitHub Action
image: dockerpracticesig/docker_practice:gitbook image: dockerpracticesig/docker_practice:mdpress
ports: ports:
- 4000:80 - 4000:80
vuepress-offline: vuepress-offline:
<< : *gitbook-offline << : *mdpress-offline
image: dockerpracticesig/docker_practice:vuepress image: dockerpracticesig/docker_practice:vuepress
# developer test docker image # developer test docker image

View File

@@ -11,16 +11,17 @@
"gitbook-plugin-github": "^3.0.0", "gitbook-plugin-github": "^3.0.0",
"gitbook-plugin-mermaid-gb3": "^2.1.0", "gitbook-plugin-mermaid-gb3": "^2.1.0",
"gitbook-plugin-page-treeview": "^3.0.6", "gitbook-plugin-page-treeview": "^3.0.6",
"honkit": "^6.1.6",
"vuepress": "1.9.10", "vuepress": "1.9.10",
"vuepress-plugin-container": "^2.1.5", "vuepress-plugin-container": "^2.1.5",
"vuepress-theme-hope": "^1.0.0" "vuepress-theme-hope": "^1.0.0"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"honkit:help": "npx honkit help", "mdpress:help": "mdpress --help",
"honkit:build": "npx honkit build", "build": "rm -rf _site _site_site && mdpress build --format site --output _site && rm -rf _site && mv _site_site _site",
"honkit:serve": "npx honkit serve", "serve": "mdpress serve",
"start": "mdpress serve",
"pdf": "mdpress build --format pdf",
"vuepress:build": "npx vuepress build", "vuepress:build": "npx vuepress build",
"vuepress": "npx vuepress" "vuepress": "npx vuepress"
}, },