2019-08-31 10:36:00 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
2020-10-14 03:52:48 +00:00
|
|
|
workflow_dispatch:
|
2019-08-31 10:36:00 +00:00
|
|
|
|
|
|
|
name: CI
|
|
|
|
|
2021-03-07 07:29:05 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash --noprofile --norc -exo pipefail {0}
|
|
|
|
|
2019-08-31 10:36:00 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
2020-12-20 14:32:04 +00:00
|
|
|
name: Build
|
2019-08-31 10:36:00 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@master
|
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
2020-12-20 14:32:04 +00:00
|
|
|
- name: Build Gitbook
|
2019-08-31 10:36:00 +00:00
|
|
|
uses: docker://yeasy/docker_practice
|
|
|
|
with:
|
|
|
|
args: build
|
2020-12-20 14:32:04 +00:00
|
|
|
- name: Build Gitbook Docker Image
|
|
|
|
if: github.repository == 'docker-practice/docker_practice'
|
|
|
|
run: |
|
|
|
|
sudo chmod -R 777 _book
|
|
|
|
echo "FROM nginx:alpine" >> Dockerfile
|
|
|
|
echo "COPY _book /usr/share/nginx/html" >> Dockerfile
|
|
|
|
echo "COPY .docker/docker-entrypoint.sh /" >> Dockerfile
|
|
|
|
echo "ENTRYPOINT [\"/docker-entrypoint.sh\"]" >> Dockerfile
|
|
|
|
|
|
|
|
export VCS_REF=`git rev-parse --short HEAD`
|
|
|
|
|
|
|
|
docker build \
|
|
|
|
-t dockerpracticesig/docker_practice \
|
|
|
|
-t dockerpracticesig/docker_practice:gitbook \
|
|
|
|
--label org.opencontainers.image.revision=$VCS_REF \
|
|
|
|
--label org.opencontainers.image.source="https://github.com/yeasy/docker_practice" \
|
|
|
|
--label maintainer="https://github.com/docker-practice" \
|
|
|
|
.
|
|
|
|
|
|
|
|
docker run -d --rm -p 4000:80 dockerpracticesig/docker_practice
|
|
|
|
|
|
|
|
sleep 5
|
2021-03-07 07:29:05 +00:00
|
|
|
|
|
|
|
echo "::group::Test"
|
2020-12-20 14:32:04 +00:00
|
|
|
curl 127.0.0.1:4000
|
2021-03-07 07:29:05 +00:00
|
|
|
echo "::endgroup::"
|
2020-12-20 14:32:04 +00:00
|
|
|
|
|
|
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
|
|
docker push dockerpracticesig/docker_practice
|
|
|
|
docker push dockerpracticesig/docker_practice:gitbook
|
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
|
|
|
|
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
|
|
|
|
- name: Upload Gitbook dist
|
|
|
|
uses: docker://pcit/pages
|
|
|
|
if: github.repository == 'docker-practice/docker_practice'
|
|
|
|
env:
|
|
|
|
PCIT_EMAIL: khs1994@khs1994.com
|
|
|
|
PCIT_GIT_TOKEN: ${{ secrets.PCIT_GIT_TOKEN }}
|
|
|
|
PCIT_GIT_URL: github.com/docker-practice/zh-cn
|
|
|
|
PCIT_KEEP_HISTORY: "true"
|
|
|
|
PCIT_LOCAL_DIR: _book
|
|
|
|
PCIT_MESSAGE: Build from yeasy/docker_practice@${{github.sha}}
|
|
|
|
PCIT_TARGET_BRANCH: master
|
|
|
|
PCIT_USERNAME: khs1994
|
2019-10-29 06:31:45 +00:00
|
|
|
- name: vuepress
|
|
|
|
run: |
|
2019-11-06 02:44:57 +00:00
|
|
|
sudo rm -rf _book
|
2020-10-14 05:40:46 +00:00
|
|
|
# npm i vuepress --save-dev
|
2019-12-09 05:40:10 +00:00
|
|
|
npm i
|
2020-10-13 14:24:30 +00:00
|
|
|
|
|
|
|
git clone https://github.com/docker-practice/.vuepress .vuepress2
|
|
|
|
cp -r .vuepress2/. .vuepress/
|
|
|
|
rm -rf .vuepress2
|
|
|
|
find . \( -path "./mesos" -o -path "./machine" -o -path "./swarm_mode" -o -path "./node_modules" -o -path "./.vuepress" -o -path "./_book" -o -path "./CHANGELOG.md" -o -path "./CONTRIBUTING.md" \) -prune -o -name "*.md" -exec sed -i 'N;2a\<AdSenseTitle/>\n' {} \;
|
|
|
|
|
2020-10-14 05:40:46 +00:00
|
|
|
npx vuepress --version
|
|
|
|
|
2020-10-13 14:24:30 +00:00
|
|
|
npm run vuepress:build
|
2019-11-06 05:16:09 +00:00
|
|
|
echo "vuepress.docker-practice.com" > .vuepress/dist/CNAME
|
2020-02-23 02:14:40 +00:00
|
|
|
|
|
|
|
cp -r _images .vuepress/dist
|
|
|
|
cp -r advanced_network/_images .vuepress/dist/advanced_network
|
|
|
|
cp -r appendix/_images .vuepress/dist/appendix
|
|
|
|
cp -r cases/ci/drone/_images .vuepress/dist/cases/ci/drone
|
|
|
|
cp -r cases/os/_images .vuepress/dist/cases/os
|
|
|
|
cp -r cloud/_images .vuepress/dist/cloud
|
|
|
|
cp -r data_management/_images .vuepress/dist/data_management
|
|
|
|
cp -r etcd/_images .vuepress/dist/etcd
|
|
|
|
cp -r image/_images .vuepress/dist/image
|
|
|
|
cp -r install/_images .vuepress/dist/install
|
|
|
|
cp -r introduction/_images .vuepress/dist/introduction
|
|
|
|
cp -r kubernetes/_images .vuepress/dist/kubernetes
|
|
|
|
cp -r underly/_images .vuepress/dist/underly
|
2020-02-23 13:57:26 +00:00
|
|
|
|
2020-10-13 14:24:30 +00:00
|
|
|
echo "include: [_images]" > .vuepress/dist/_config.yml
|
2019-10-29 06:31:45 +00:00
|
|
|
- name: Upload Vuepress dist
|
|
|
|
uses: docker://pcit/pages
|
2019-11-06 02:44:57 +00:00
|
|
|
if: github.repository == 'docker-practice/docker_practice'
|
2019-10-29 06:31:45 +00:00
|
|
|
env:
|
|
|
|
PCIT_EMAIL: khs1994@khs1994.com
|
|
|
|
PCIT_GIT_TOKEN: ${{ secrets.PCIT_GIT_TOKEN }}
|
|
|
|
PCIT_GIT_URL: github.com/docker-practice/vuepress
|
2019-12-31 12:26:22 +00:00
|
|
|
PCIT_KEEP_HISTORY: "true"
|
2019-10-29 06:31:45 +00:00
|
|
|
PCIT_LOCAL_DIR: .vuepress/dist
|
2020-12-20 15:22:30 +00:00
|
|
|
PCIT_MESSAGE: Build from yeasy/docker_practice@${{github.sha}}
|
2019-10-29 06:31:45 +00:00
|
|
|
PCIT_TARGET_BRANCH: master
|
|
|
|
PCIT_USERNAME: khs1994
|
2019-11-29 15:16:18 +00:00
|
|
|
- name: Set coding.net CNAME
|
|
|
|
run: |
|
|
|
|
echo "vuepress.mirror.docker-practice.com" > .vuepress/dist/CNAME
|
2019-11-06 05:16:09 +00:00
|
|
|
- name: Upload Vuepress dist to coding.net
|
|
|
|
uses: docker://pcit/pages
|
|
|
|
if: github.repository == 'docker-practice/docker_practice'
|
|
|
|
env:
|
|
|
|
PCIT_EMAIL: khs1994@khs1994.com
|
|
|
|
PCIT_GIT_TOKEN: ${{ secrets.CODING_GIT_TOKEN }}
|
2020-02-22 06:30:11 +00:00
|
|
|
PCIT_GIT_URL: e.coding.net/dpsigs/docker_practice
|
2019-12-31 12:26:22 +00:00
|
|
|
PCIT_KEEP_HISTORY: "true"
|
2019-11-06 05:16:09 +00:00
|
|
|
PCIT_LOCAL_DIR: .vuepress/dist
|
2020-12-20 14:32:04 +00:00
|
|
|
PCIT_MESSAGE: Build from yeasy/docker_practice@${{github.sha}}
|
2019-11-06 05:16:09 +00:00
|
|
|
PCIT_TARGET_BRANCH: master
|
2020-02-22 06:30:11 +00:00
|
|
|
PCIT_USERNAME: ptt0xjqzbke3
|
2020-04-28 14:39:47 +00:00
|
|
|
- name: Build vuepress docker image
|
|
|
|
if: github.repository == 'docker-practice/docker_practice'
|
|
|
|
run: |
|
|
|
|
sudo rm -rf .vuepress/dist/.git
|
|
|
|
|
2021-03-02 16:11:07 +00:00
|
|
|
echo "FROM nginx:alpine" > Dockerfile
|
2020-04-28 14:39:47 +00:00
|
|
|
echo "COPY .vuepress/dist /usr/share/nginx/html" >> Dockerfile
|
2020-04-28 15:26:55 +00:00
|
|
|
echo "COPY .docker/docker-entrypoint.sh /" >> Dockerfile
|
2020-07-03 04:10:24 +00:00
|
|
|
echo "ENTRYPOINT [\"/docker-entrypoint.sh\"]" >> Dockerfile
|
2020-04-28 14:39:47 +00:00
|
|
|
|
|
|
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
|
|
|
|
|
|
VCS_REF=`git rev-parse --short HEAD`
|
|
|
|
|
|
|
|
docker build -t dockerpracticesig/docker_practice:vuepress \
|
|
|
|
--label org.opencontainers.image.revision=$VCS_REF \
|
|
|
|
--label org.opencontainers.image.source="https://github.com/yeasy/docker_practice" \
|
2020-04-28 15:26:55 +00:00
|
|
|
--label maintainer="https://github.com/docker-practice" \
|
2020-04-28 14:39:47 +00:00
|
|
|
.
|
|
|
|
|
|
|
|
docker push dockerpracticesig/docker_practice:vuepress
|
2020-07-03 04:10:24 +00:00
|
|
|
|
2021-03-07 07:29:05 +00:00
|
|
|
docker run -it --rm -d -p 4001:80 dockerpracticesig/docker_practice:vuepress
|
2020-07-03 04:10:24 +00:00
|
|
|
|
2021-03-07 07:29:05 +00:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
echo "::group::Test"
|
|
|
|
curl 127.0.0.1:4001
|
|
|
|
echo "::endgroup::"
|
2020-04-28 14:39:47 +00:00
|
|
|
env:
|
|
|
|
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
|
|
|
|
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
|