docker_practice/cases/ci/travis.md

48 lines
1.3 KiB
Go
Raw Normal View History

## Travis CI 使 Docker
GitHub [Travis CI](https://travis-ci.com/) 会根据项目根目录 `.travis.yml` 文件设置的指令,执行一系列操作。
Travis CI 使 Docker /CI/CD GitHub Docker Docker Hub
###
https://travis-ci.com/account/repositories 选择 GitHub 仓库,按照指引安装 GitHub App 来启用 GitHub 仓库构建。
`Dockerfile`
```dockerfile
FROM alpine
RUN echo "Hello World"
```
Travis CI `.travis.yml`
```yml
language: bash
dist: xenial
services:
- docker
before_script:
# docker hub
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
script:
#
- echo "test code"
after_success:
#
- docker build -t username/alpine .
- docker push username/alpine
```
> Travis CI `DOCKER_PASSWORD` `DOCKER_USERNAME`
###
GitHub, [Travis CI](https://travis-ci.com/) 查看构建详情。