This is a devops for docker image and its deployment (using docker compose) for armv6 and x86. It contains:
- Dockerfile template for image.
- Docker compose file template for deployment.
- gitbook template for github page.
- travis file template for CI.
You can use this project to quick start your docker image project with the following outcome,
- It sets up local build process
- It sets up travis build process
cd myproj
Get the release
wget https://github.com/hellstein/devops-docker/releases/download/0.2.3/proj-0.2.3.zip
unzip proj-0.2.3.zip
You will see the proj folder.
mv proj/* proj/.[!.]* ./
rm -rf proj*
./set_owner_repo [OWNER] [REPO]Till now, you can validate by
Local build process
Create docker image by
make mk-image ARCH=x86ormake mk-image ARCH=armv6. Test result withdocker images.Create gitbook by
make mk-book, a docs folder will be generatedCreate deployment by
make mk-deployment VERSION=0.1.0, 2 zip packages will be generated according to your repository name and version.
Local clean process
- Delete docker image by
make clean-image ARCH=x86ormake clean-image ARCH=armv6 - Delete gitbook result by
make clean-book - Delete deployment result by
make clean-deployment VERSION=0.1.0
- Delete docker image by
- Modify
images/Dockerfile-armv6(x86)which defines how to build images - Go to
deployment/imageAPI-armv6 (x86)- Update
docker-compose.ymlwhich defines how to run images - Update
temp.envwhich defines environment variable used bydocker-compose.yml
- Update
specify the docker hub account info
travis logintravis enable- Change
.envby settingDOCKER_USERandDOCKER_PASS ./set_docker_account
Set github release api key
Go to github and get a token.
./set_release_api_key [token]- Modify the indentation like below:
deploy:
- provider: scriptscript: make pushtohub USER=$DOCKER_USER PASS=$DOCKER_PASS ARCH=$ARCH TAG=$TRAVIS_BRANCHon:
all_branches: truecondition: "$TRAVIS_BRANCH =~ ^master|develop$"
- provider: scriptscript: make pushtohub USER=$DOCKER_USER PASS=$DOCKER_PASS ARCH=$ARCH TAG=$TRAVIS_TAGon:
tags: trueall_branches: true
- provider: releasesprerelease: trueskip_cleanup: truefile_glob: truefile: "./*.zip"api_key:
secure: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxon:
tags: true- Test whether .travis.yml is ok
travis lint .travis.yml- Now you can push a branch or tag to check whether travis does its job as expected