build vuepress docker image

Signed-off-by: Kang Huaishuai <khs1994@khs1994.com>
pull/451/head
Kang Huaishuai 2020-04-28 22:39:47 +08:00
parent 8952dee0a8
commit 683cf95ca7
No known key found for this signature in database
GPG Key ID: 5E515022F565DA09
3 changed files with 33 additions and 1 deletions

View File

@ -12,6 +12,7 @@ jobs:
- uses: actions/checkout@master - uses: actions/checkout@master
with: with:
fetch-depth: 1 fetch-depth: 1
# search Issues :-(
- run: | - run: |
docker run -i --rm \ docker run -i --rm \
-v $PWD:/mnt:ro \ -v $PWD:/mnt:ro \
@ -56,6 +57,8 @@ jobs:
"en.wikipedia.org/wiki/UnionFS",\ "en.wikipedia.org/wiki/UnionFS",\
"product.china-pub.com",\ "product.china-pub.com",\
"union-click.jd.com",\ "union-click.jd.com",\
"x.x.x.x/base",\
"x.x.x.x:9000/minio/",\
"www.aliyun.com" \ "www.aliyun.com" \
--allow-dupe \ --allow-dupe \
--skip-save-results \ --skip-save-results \

View File

@ -67,3 +67,24 @@ jobs:
PCIT_MESSAGE: Sync from yeasy/docker_practice@${{github.sha}} by PCIT PCIT_MESSAGE: Sync from yeasy/docker_practice@${{github.sha}} by PCIT
PCIT_TARGET_BRANCH: master PCIT_TARGET_BRANCH: master
PCIT_USERNAME: ptt0xjqzbke3 PCIT_USERNAME: ptt0xjqzbke3
- name: Build vuepress docker image
if: github.repository == 'docker-practice/docker_practice'
run: |
sudo rm -rf .vuepress/dist/.git
echo "FROM nginx:alpine" >> Dockerfile
echo "COPY .vuepress/dist /usr/share/nginx/html" >> Dockerfile
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" \
.
docker push dockerpracticesig/docker_practice:vuepress
env:
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}

View File

@ -22,14 +22,22 @@ after_success:
- echo "COPY _book /usr/share/nginx/html" >> Dockerfile - echo "COPY _book /usr/share/nginx/html" >> Dockerfile
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- 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" \
.
- docker build -t dockerpracticesig/docker_practice .
- docker run -dit --rm -p 4000:80 dockerpracticesig/docker_practice - docker run -dit --rm -p 4000:80 dockerpracticesig/docker_practice
- sleep 5 - sleep 5
- curl 127.0.0.1:4000 - curl 127.0.0.1:4000
- docker push dockerpracticesig/docker_practice - docker push dockerpracticesig/docker_practice
- docker push dockerpracticesig/docker_practice:gitbook
- cd _book - cd _book
- rm -rf .github/workflows - rm -rf .github/workflows