-
Notifications
You must be signed in to change notification settings - Fork 55
Docker Image Generation and Deployment
Docker image generation and deployment is supported through continuous integration (CI).
Development of ATS2 primarily happens in ATS-Postiats, but the released docker image is built from ATS-Postiats-release, which is a repository created for releasing ATS2.
In ATS-Postiats-release, the scripts for CI are stored inside the my-travis-ci
folder (accessible from on-line). The CI script in travis.yml can be triggered to start a build process including the following phases:
- Prepare: install dependencies, install ATS1
- Testing: compile ATS2, run regression test
- Post-Testing: build docker image and push to docker hub, build ATS2 books and tutorials
The triggering happens on every commit or pull request, and it can be tracked on-line. While the build process runs in four combinations of OS (linux
, macosx
) and compilers (gcc
, clang
), the docker image is only built in the linux/gcc
combination.
The docker image is hosted at on-line, where steinwaywhw/ats:github
is the latest dev image. You can use the following command-line:
docker pull steinwaywhw/ats:github
to get this image. You can use, for example, the following command-line:
docker run --volume=$(PWD):/tmp --rm -it steinwaywhw/ats:github bash
to enter the image and mount the current directory on the host machine into /tmp
inside the docker.
The image is built on top of a base image to save time. Otherwise, TravisCI may kill the process for running overtime. The base image is also hosted on-line, and it is published as steinwaywhw/ats-base
on docker hub. The base image contains all library dependencies (e.g., libgmp
, libjson
) and various target language runtimes (e.g., Erlang
, Python
, nodejs
) and tools (e.g.,Z3
). You can check the GitHub repo for details.
On top of this base image, the script (build_docker.sh
, Dockerfile
) builds the image during CI. One can take a look at the following involved script files (with self-explanatory names):
-
install_ats1.sh
, install ATS1 -
install_osx.sh
, install dependencies when testing undermacosx
-
install_ats2.sh
, compile and install ATS2 -
install_contrib.sh
, compile and install contributed libraries -
install_utilities.sh
, compile and install some ATS2 tools -
test_regress.sh
, run regression tests -
build_docker.sh
, build and push the image -
Dockerfile
, the spec for building Docker image
In particular, the script build_docker.sh
is in charge of building and pushing the image.
One thing to note is that the same scripts are used for both TravisCI testing and for Docker image building. If the TravisCI testing passes, the Docker image building should also finish successfully.
The login for docker hub is handled in travis.yml
by calling docker login
with a username and a password. This info is encrypted as a secure
item under the env
section in travis.yml
. To encrypt, please refer to the following on-line documentation:
https://docs.travis-ci.com/user/environment-variables/#Encrypting-environment-variables
Note such encryption is repository-dependent. Many failed builds in the past were due to wrong encryption (causing login failure).
- If we are on the master branch, and we have a tag, we tag the image as
steinwaywhw/ats:some_version
andsteinwaywhw/ats:latest
since this is a formal release. - If we are on the master branch, but this commit does not contain a tag, we tag the image as
steinwaywhw/ats:github
since this is not a release version, but just a new commit in the GitHub repo. - If we are not on the master branch, we tag the image as
steinwaywhw/ats:some_branch
.
After the Docker image builds, docker push
is called to push the image to the Docker hub.