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=x86
ormake mk-image ARCH=armv6
. Test result withdocker images
. -
Create gitbook by
make mk-book
, a docs folder will be generated -
Create 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=x86
ormake 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.yml
which defines how to run images - Update
temp.env
which defines environment variable used bydocker-compose.yml
- Update
-
specify the docker hub account info
travis login
travis enable
- Change
.env
by settingDOCKER_USER
andDOCKER_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: script
script: make pushtohub USER=$DOCKER_USER PASS=$DOCKER_PASS ARCH=$ARCH TAG=$TRAVIS_BRANCH
on:
all_branches: true
condition: "$TRAVIS_BRANCH =~ ^master|develop$"
- provider: script
script: make pushtohub USER=$DOCKER_USER PASS=$DOCKER_PASS ARCH=$ARCH TAG=$TRAVIS_TAG
on:
tags: true
all_branches: true
- provider: releases
prerelease: true
skip_cleanup: true
file_glob: true
file: "./*.zip"
api_key:
secure: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
on:
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