-
Notifications
You must be signed in to change notification settings - Fork 0
Home
brownyuan edited this page Dec 2, 2018
·
12 revisions
This is a template 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
- Go to the release page
- Select the latest release and click to download
- Unzip the template
unzip docker-example-[version].zip -d [project]Make a new repository in Github before git push
cd [project]/
git init
git add -A
git commit -m "add docker image template"
git remote add origin https://github.com/OWNER/REPO.git
git push -u origin master./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 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=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: 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