mirror of
https://github.com/yeasy/docker_practice.git
synced 2024-12-24 22:18:54 +00:00
parent
4667ffb091
commit
81ec7190d6
@ -14,6 +14,14 @@ script:
|
||||
- docker run -it --rm -v $PWD:/srv/gitbook-src yeasy/docker_practice build
|
||||
after_success:
|
||||
- sudo chmod -R 777 _book
|
||||
- echo "FROM nginx:alpine" >> Dockerfile
|
||||
- echo "COPY _book /usr/share/nginx/html" >> Dockerfile
|
||||
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
|
||||
- docker build -t dockerpracticecn/docker_practice .
|
||||
- docker run -dit --rm -p 4000:80 dockerpracticecn/docker_practice
|
||||
- sleep 5
|
||||
- curl 127.0.0.1:4000
|
||||
- docker push dockerpracticecn/docker_practice
|
||||
- cd _book
|
||||
- git init
|
||||
- git remote add origin "$REPO"
|
||||
|
22
bin/offline
22
bin/offline
@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f offline ];then echo "请在项目根目录执行 $0"; exit 1; fi
|
||||
|
||||
command -v docker-compose > /dev/null 2>&1
|
||||
|
||||
if [ $? != 0 ];then echo "请安装 docker-compose"; exit 1; fi
|
||||
|
||||
if [ "$1" = update ];then
|
||||
status=`git status -s`
|
||||
if [ -z "$status" ];then
|
||||
git fetch --depth=1 origin master
|
||||
git reset --hard origin/master
|
||||
else
|
||||
echo "您已修改项目,请提交或恢复原状!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
docker-compose up server
|
||||
|
||||
docker-compose down
|
@ -1,6 +1,8 @@
|
||||
version: "3"
|
||||
services:
|
||||
|
||||
# $ docker-compose up server => up a server,Only Support Linux or macOS
|
||||
|
||||
server:
|
||||
image: yeasy/docker_practice:latest
|
||||
ports:
|
||||
@ -9,14 +11,7 @@ services:
|
||||
- ./:/srv/gitbook-src
|
||||
command: server
|
||||
|
||||
windows:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- ./:/srv/www
|
||||
- .travis/conf.d:/etc/nginx/conf.d
|
||||
ports:
|
||||
- 4000:4000
|
||||
command: ["nginx", "-c", "/etc/nginx/conf.d/nginx.conf", "-g", "daemon off;"]
|
||||
# $ docker-compose up build => build gitbook
|
||||
|
||||
build:
|
||||
image: yeasy/docker_practice:latest
|
||||
@ -24,6 +19,18 @@ services:
|
||||
- ./:/srv/gitbook-src
|
||||
command: build
|
||||
|
||||
# $ docker run -it --rm -p 4000:80 dockerpracticecn/docker_practice
|
||||
|
||||
# $ docker up offline
|
||||
|
||||
offline:
|
||||
# this image build by travis ci
|
||||
image: dockerpracticecn/docker_practice
|
||||
ports:
|
||||
- 4000:80
|
||||
|
||||
# developer test docker image
|
||||
|
||||
development:
|
||||
build: ./.travis
|
||||
image: yeasy/docker_practice:latest
|
||||
|
Loading…
Reference in New Issue
Block a user