2017-11-28 05:38:13 +00:00
|
|
|
language: bash
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
services:
|
|
|
|
- docker
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
before_install:
|
|
|
|
- openssl aes-256-cbc -K $encrypted_6cc8cff04075_key -iv $encrypted_6cc8cff04075_iv
|
|
|
|
-in .travis/id_rsa.enc -out ~/.ssh/id_rsa -d
|
|
|
|
- chmod 600 ~/.ssh/id_rsa
|
|
|
|
- export TZ='Asia/Shanghai'
|
|
|
|
- date
|
|
|
|
- git config --global user.name "khs1994"
|
|
|
|
- git config --global user.email "khs1994@khs1994.com"
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
script:
|
|
|
|
- docker run -it --rm -v $PWD:/srv/gitbook-src yeasy/docker_practice build
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
after_success:
|
|
|
|
- sudo chmod -R 777 _book
|
2019-08-31 09:47:38 +00:00
|
|
|
|
|
|
|
- echo "FROM nginx:alpine" >> Dockerfile
|
2018-01-23 13:34:32 +00:00
|
|
|
- echo "COPY _book /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
|
2019-08-31 09:47:38 +00:00
|
|
|
|
2018-03-30 02:04:01 +00:00
|
|
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
2020-04-28 14:39:47 +00:00
|
|
|
- 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" \
|
2020-04-28 15:26:55 +00:00
|
|
|
--label maintainer="https://github.com/docker-practice" \
|
2020-04-28 14:39:47 +00:00
|
|
|
.
|
2019-08-31 09:47:38 +00:00
|
|
|
|
|
|
|
- docker run -dit --rm -p 4000:80 dockerpracticesig/docker_practice
|
|
|
|
|
2018-01-23 13:34:32 +00:00
|
|
|
- sleep 5
|
|
|
|
- curl 127.0.0.1:4000
|
2019-08-31 09:47:38 +00:00
|
|
|
|
|
|
|
- docker push dockerpracticesig/docker_practice
|
2020-04-28 14:39:47 +00:00
|
|
|
- docker push dockerpracticesig/docker_practice:gitbook
|
2019-08-31 09:47:38 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
- cd _book
|
2020-03-12 07:04:21 +00:00
|
|
|
- rm -rf .github/workflows
|
2017-11-28 05:38:13 +00:00
|
|
|
- git init
|
2019-09-05 04:59:25 +00:00
|
|
|
- git remote add origin "$DEPLOY_REPO"
|
2017-11-28 05:38:13 +00:00
|
|
|
- git add .
|
|
|
|
- COMMIT=`date "+%F %T"`
|
2020-03-12 07:07:44 +00:00
|
|
|
- git commit -m "Travis CI Site updated $COMMIT yeasy/docker_practice@${TRAVIS_COMMIT}"
|
2017-11-28 05:38:13 +00:00
|
|
|
- git push -f origin master:"$DEPLOY_BRANCH"
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
env:
|
|
|
|
global:
|
2019-09-05 04:59:25 +00:00
|
|
|
- DEPLOY_BRANCH: master
|
|
|
|
- DEPLOY_REPO: git@github.com:docker-practice/zh-cn.git
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
addons:
|
|
|
|
ssh_known_hosts:
|
|
|
|
- github.com
|
2019-03-29 03:41:02 +00:00
|
|
|
|
2017-11-28 05:38:13 +00:00
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- master
|