blob: 1f67d1d733182199e4edebfb23a215b4c66f9bc7 [file] [log] [blame] [view]
James E. King, III0ad20bd2017-09-30 15:44:16 -07001# Docker Integration #
James E. King, III65efdff2017-09-25 00:13:38 -04002
James E. King IIIf5f430d2018-06-08 03:37:55 +00003Due to the large number of languages supported by Apache Thrift,
4docker containers are used to build and test the project on a
5variety of platforms to provide maximum test coverage.
6
7## Appveyor Integration ##
8
9At this time the Appveyor scripts do not use docker containers.
10Once Microsoft supports Visual Studio Build Tools running inside
11nano containers (instead of Core, which is huge) then we will
12consider using containers for the Windows builds as well.
jfarrelle03f7e82015-02-18 23:25:54 -050013
James E. King, III0ad20bd2017-09-30 15:44:16 -070014## Travis CI Integration ##
jfarrelle03f7e82015-02-18 23:25:54 -050015
James E. King IIIf5f430d2018-06-08 03:37:55 +000016The Travis CI scripts use the following environment variables and
17logic to determine their behavior:
James E. King, III0ad20bd2017-09-30 15:44:16 -070018
19### Environment Variables ###
20
21| Variable | Default | Usage |
22| -------- | ----- | ------- |
Thomasc890ed42024-02-25 19:58:30 +090023| `DISTRO` | `ubuntu-focal` | Set by various build jobs in `.travis.yml` to run builds in different containers. Not intended to be set externally.|
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040024| `DOCKER_REPO` | `thrift/thrift-build` | The name of the Docker Hub repository to obtain and store docker images. |
25| `DOCKER_USER` | `<none>` | The Docker Hub account name containing the repository. |
James E. King, III0ad20bd2017-09-30 15:44:16 -070026| `DOCKER_PASS` | `<none>` | The Docker Hub account password to use when pushing new tags. |
27
Thomasc890ed42024-02-25 19:58:30 +090028For example, the default docker image that is used in builds if no overrides are specified would be: `thrift/thrift-build:ubuntu-focal`
James E. King, III0ad20bd2017-09-30 15:44:16 -070029
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040030### Forks ###
31
James E. King IIIf5f430d2018-06-08 03:37:55 +000032If you have forked the Apache Thrift repository and you would like
33to use your own Docker Hub account to store thrift build images,
34you can use the Travis CI web interface to set the `DOCKER_USER`,
35`DOCKER_PASS`, and `DOCKER_REPO` variables in a secure manner.
36Your fork builds will then pull, push, and tag the docker images
37in your account.
James E. King, III0ad20bd2017-09-30 15:44:16 -070038
39### Logic ###
40
James E. King IIIf5f430d2018-06-08 03:37:55 +000041The Travis CI build runs in two phases - first the docker images are rebuilt
42for each of the supported containers if they do not match the Dockerfile that
43was used to build the most recent tag. If a `DOCKER_PASS` environment
44variable is specified, the docker stage builds will attempt to log into
45Docker Hub and push the resulting tags.
James E. King, III0ad20bd2017-09-30 15:44:16 -070046
47## Supported Containers ##
48
Thomasc890ed42024-02-25 19:58:30 +090049The Travis CI (continuous integration) builds use the Ubuntu Jammy
50(22.04 LTS) and Focal (20.04 LTS) images to maximize language level
James E. King IIIf5f430d2018-06-08 03:37:55 +000051coverage.
James E. King, IIId7142b72017-09-01 13:00:36 -070052
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040053### Ubuntu ###
54
Jiayu Liu1d61fe12022-10-10 08:45:10 +080055* focal (stable, current)
Jiayu Liu1d61fe12022-10-10 08:45:10 +080056* jammy (next stable, WIP)
James E. King, III0ad20bd2017-09-30 15:44:16 -070057
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040058## Unsupported Containers ##
James E. King, III0ad20bd2017-09-30 15:44:16 -070059
60These containers may be in various states, and may not build everything.
James E. King IIIf5f430d2018-06-08 03:37:55 +000061They can be found in the `old/` subdirectory.
jfarrelle03f7e82015-02-18 23:25:54 -050062
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040063### CentOS ###
James E. King, III65efdff2017-09-25 00:13:38 -040064* 7.3
65 * make check in lib/py may hang in test_sslsocket - root cause unknown
66
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040067### Debian ###
68
James E. King, III65efdff2017-09-25 00:13:38 -040069* jessie
70* stretch
71 * make check in lib/cpp fails due to https://svn.boost.org/trac10/ticket/12507
72
James E. King, IIIcfb01302017-11-11 09:39:19 -050073## Building like Travis CI does, locally ##
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040074
James E. King IIIf5f430d2018-06-08 03:37:55 +000075We recommend you build locally the same way Travis CI does, so that when you
76submit your pull request you will run into fewer surprises. To make it a
77little easier, put the following into your `~/.bash_aliases` file:
jfarrelle03f7e82015-02-18 23:25:54 -050078
James E. King, IIIcfb01302017-11-11 09:39:19 -050079 # Kill all running containers.
80 alias dockerkillall='docker kill $(docker ps -q)'
jfarrelle03f7e82015-02-18 23:25:54 -050081
James E. King, IIIcfb01302017-11-11 09:39:19 -050082 # Delete all stopped containers.
83 alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
jfarrelle03f7e82015-02-18 23:25:54 -050084
James E. King, IIIcfb01302017-11-11 09:39:19 -050085 # Delete all untagged images.
86 alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
jfarrelle03f7e82015-02-18 23:25:54 -050087
James E. King, IIIcfb01302017-11-11 09:39:19 -050088 # Delete all stopped containers and untagged images.
89 alias dockerclean='dockercleanc || true && dockercleani'
90
91 # Build a thrift docker image (run from top level of git repo): argument #1 is image type (ubuntu, centos, etc).
92 function dockerbuild
93 {
94 docker build -t $1 build/docker/$1
95 }
96
97 # Run a thrift docker image: argument #1 is image type (ubuntu, centos, etc).
98 function dockerrun
99 {
100 docker run -v $(pwd):/thrift/src -it $1 /bin/bash
101 }
102
James E. King IIIf5f430d2018-06-08 03:37:55 +0000103Then, to pull down the current image being used to build (the same way
104Travis CI does it) - if it is out of date in any way it will build a
105new one for you:
James E. King, IIIcfb01302017-11-11 09:39:19 -0500106
Thomasc890ed42024-02-25 19:58:30 +0900107 thrift$ DOCKER_REPO=thrift/thrift-build DISTRO=ubuntu-focal build/docker/refresh.sh
James E. King, IIIcfb01302017-11-11 09:39:19 -0500108
James E. King IIIf5f430d2018-06-08 03:37:55 +0000109To run all unit tests (just like Travis CI does):
James E. King, IIIcfb01302017-11-11 09:39:19 -0500110
Thomasc890ed42024-02-25 19:58:30 +0900111 thrift$ dockerrun thrift/thrift-build:ubuntu-focal
James E. King, IIIcfb01302017-11-11 09:39:19 -0500112 root@8caf56b0ce7b:/thrift/src# build/docker/scripts/autotools.sh
113
James E. King IIIf5f430d2018-06-08 03:37:55 +0000114To run the cross tests (just like Travis CI does):
James E. King, IIIcfb01302017-11-11 09:39:19 -0500115
Thomasc890ed42024-02-25 19:58:30 +0900116 thrift$ dockerrun thrift/thrift-build:ubuntu-focal
James E. King, IIIcfb01302017-11-11 09:39:19 -0500117 root@8caf56b0ce7b:/thrift/src# build/docker/scripts/cross-test.sh
118
119When you are done, you want to clean up occasionally so that docker isn't using lots of extra disk space:
120
121 thrift$ dockerclean
122
James E. King IIIf5f430d2018-06-08 03:37:55 +0000123You need to run the docker commands from the root of the local clone of the
124thrift git repository for them to work.
James E. King, IIIcfb01302017-11-11 09:39:19 -0500125
James E. King IIIf5f430d2018-06-08 03:37:55 +0000126When you are done in the root docker shell you can `exit` to go back to
127your user host shell. Once the unit tests and cross test passes locally,
128submit the changes, and if desired squash the pull request to one commit
129to make it easier to merge (the committers can squash at commit time now
130that GitHub is the master repository). Now you are building like Travis CI does!
James E. King, IIIcfb01302017-11-11 09:39:19 -0500131
132## Raw Commands for Building with Docker ##
133
134If you do not want to use the same scripts Travis CI does, you can do it manually:
135
136Build the image:
137
thomasbruggink5d0205d2024-11-05 15:33:18 +0900138Linux:
Thomasc890ed42024-02-25 19:58:30 +0900139
140 thrift$ docker build --build-arg uid=$(id -u) --build-arg gid=$(id -g) -t thrift build/docker/ubuntu-jammy
141
thomasbruggink5d0205d2024-11-05 15:33:18 +0900142Windows/Mac:
Thomasc890ed42024-02-25 19:58:30 +0900143
144 thrift$ docker build -t thrift build/docker/ubuntu-jammy
145
James E. King, IIIcfb01302017-11-11 09:39:19 -0500146
147Open a command prompt in the image:
148
149 thrift$ docker run -v $(pwd):/thrift/src -it thrift /bin/bash
jfarrelle03f7e82015-02-18 23:25:54 -0500150
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400151## Core Tool Versions per Dockerfile ##
152
Thomasf8431852024-03-05 23:21:05 +0900153Last updated: March 5, 2024
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400154
Thomasf8431852024-03-05 23:21:05 +0900155| Tool | ubuntu-focal | ubuntu-jammy | Notes |
James E. King IIIa37feaf2018-03-06 15:11:01 -0500156| :-------- | :------------ | :------------ | :---- |
Thomasf8431852024-03-05 23:21:05 +0900157| ant | 1.10.7 | 1.10.12 | |
158| autoconf | 2.69 | 2.71 | |
159| automake | 1.16.1 | 1.16.5 | |
160| bison | 3.5.1 | 3.8.2 | |
161| boost | 1.71.0 | 1.74.0 | |
162| cmake | 3.16.3 | 3.22.1 | |
163| cppcheck | 1.90 | 2.7 | |
164| flex | 2.6.4 | 2.6.4 | |
165| libc6 | 2.31 | 2.35 | glibc |
166| libevent | 2.0.16 | 2.0.16 | |
167| libstdc++ | 10.5.0 | 10.5.0 | |
168| make | 4.2.1 | 4.3 | |
169| openssl | 1.1.1f | 3.0.2 | |
170| qt5 | 5.12.8 | 5.15.3 | |
James E. King, IIId7142b72017-09-01 13:00:36 -0700171
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400172## Compiler/Language Versions per Dockerfile ##
173
Thomasf8431852024-03-05 23:21:05 +0900174| Language | ubuntu-focal | ubuntu-jammy | Notes |
James E. King IIIa37feaf2018-03-06 15:11:01 -0500175| :-------- | :------------ | :------------ | :---- |
James E. King III93ff9b02019-06-21 17:50:34 -0400176| as of | Mar 06, 2018 | Jul 1, 2019 | |
Thomasf8431852024-03-05 23:21:05 +0900177| as3 | 4.6.0 | 4.6.0 | |
178| C++ gcc | 9.4.0 | 11.4.0 | |
179| C++ clang | 13.0.0 | 13.0.0 | |
180| c\_glib | 3.2.12 | 3.2.12 | |
Max-Gerd Retzlaff04057ac2022-08-23 17:38:34 +0200181| cl (sbcl) | | 1.5.3 | |
James Lacey7054b312021-03-26 11:38:38 -0700182| d | 2.087.0 | 2.087.0 | |
Thomasf8431852024-03-05 23:21:05 +0900183| dart | 2.7.2-1 | 2.7.2-1 | |
James E. King IIIa37feaf2018-03-06 15:11:01 -0500184| delphi | | | Not in CI |
Thomasf8431852024-03-05 23:21:05 +0900185| erlang | OTP-25.3.2.9 | OTP-25.3.2.9 | |
186| go | 1.21.7 | 1.21.7 | |
187| haxe | 4.2.1 | 4.2.1 | |
188| java | 17 | 17 | |
189| js | Node.js 16.20.2, npm 8.19.4 | Node.js 16.20.2, npm 8.19.4 | |
190| lua | 5.2.4 | 5.2.4 | Lua 5.3: see THRIFT-4386 |
Jens Geyere26b4a82024-11-12 23:53:04 +0100191| netstd | 9.0 | 9.0 | |
Thomasf8431852024-03-05 23:21:05 +0900192| nodejs | 16.20.2 | 16.20.2 | |
193| ocaml | 4.08.1 | 4.13.1 | |
194| perl | 5.30.0 | 5.34.0 | |
195| php | 7.4.3 | 8.1.2 | |
196| python2 | 2.7.18 | | |
197| python3 | 3.8.10 | 3.10.12 | |
198| ruby | 2.7.0p0 | 3.0.2p107 | |
Cameron Martinda54fc82025-01-12 08:55:45 +0000199| rust | 1.83.0 | 1.83.0 | |
James E. King IIIa37feaf2018-03-06 15:11:01 -0500200| smalltalk | | | Not in CI |
Thomasf8431852024-03-05 23:21:05 +0900201| swift | 5.7 | 5.7 | |