I am going to use Travis to continue create docker multiarch images, then push back to dockerhub repo.
create a repo in my github account named travis-CICD
and add it to Travis GitHub Apps Integration
![](/2020/05/11/Travis-CI-push-docker-manifest-to-dockerhub/travis1.png)
under the travis-CICD repo, create a .travis.yml file
Since github uses ruby, I don’t need to specify the language. For this project, I am going to work on docker, so I need to start docker.
I am going to use two docker images to create a multiarch using docker manifest create
command.
Note: Because manifest is an experimental feature, I need to add DOCKER_CLI_EXPERIMENTAL=enabled
in .travis.yml file.
1 | sudo: required |
Go to dockerhub to get a new token
![](/2020/05/11/Travis-CI-push-docker-manifest-to-dockerhub/travis2.png)
install travis cli on my local
before install travis, I need to solove dependencies.
1 | sudo apt install ruby-dev libffi-dev make gcc |
to verify it
1 | anna@ubuntu1804:~/OLE_intern/travis/travis-CICD$ which travis |
create env variable for travis
1 | travis env set DOCKER_USERNAME vmnet8 |
Use travis CLI to encrypt data wiht the public key.
1 | travis encrypt --pro SOMEVAR="secretvalue" |
It will output a string, I can add it to .travis.yml file
1 | travis encrypt SOMEVAR="secretvalue" --add |
It will automaticlly add encrpted data to .travis.yml file
git add .travis.yml file, commit and push to github
after the pull request, the travis will build automatic
![](/2020/05/11/Travis-CI-push-docker-manifest-to-dockerhub/travis3.png)
exited with 0.
Go to dockerhub to verify, it pushed to dockerhub successfully.
![](/2020/05/11/Travis-CI-push-docker-manifest-to-dockerhub/travis4.png)