blob: 0f2d293dffab74cd9093eb8842789738ea232f6e [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
Jens Geyer94e1a302025-05-15 21:30:12 +020049The Travis CI (continuous integration) builds use the Ubuntu Noble (24.04 LTS),
50Jammy (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
Jens Geyer94e1a302025-05-15 21:30:12 +020055* focal (stable)
56* jammy (stable)
57* noble (next stable)
James E. King, III0ad20bd2017-09-30 15:44:16 -070058
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040059## Unsupported Containers ##
James E. King, III0ad20bd2017-09-30 15:44:16 -070060
61These containers may be in various states, and may not build everything.
James E. King IIIf5f430d2018-06-08 03:37:55 +000062They can be found in the `old/` subdirectory.
jfarrelle03f7e82015-02-18 23:25:54 -050063
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040064### CentOS ###
James E. King, III65efdff2017-09-25 00:13:38 -040065* 7.3
66 * make check in lib/py may hang in test_sslsocket - root cause unknown
67
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040068### Debian ###
69
James E. King, III65efdff2017-09-25 00:13:38 -040070* jessie
71* stretch
72 * make check in lib/cpp fails due to https://svn.boost.org/trac10/ticket/12507
73
James E. King, IIIcfb01302017-11-11 09:39:19 -050074## Building like Travis CI does, locally ##
James E. King, IIIcd5be7b2017-10-21 10:16:19 -040075
James E. King IIIf5f430d2018-06-08 03:37:55 +000076We recommend you build locally the same way Travis CI does, so that when you
77submit your pull request you will run into fewer surprises. To make it a
78little easier, put the following into your `~/.bash_aliases` file:
jfarrelle03f7e82015-02-18 23:25:54 -050079
James E. King, IIIcfb01302017-11-11 09:39:19 -050080 # Kill all running containers.
81 alias dockerkillall='docker kill $(docker ps -q)'
jfarrelle03f7e82015-02-18 23:25:54 -050082
James E. King, IIIcfb01302017-11-11 09:39:19 -050083 # Delete all stopped containers.
84 alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
jfarrelle03f7e82015-02-18 23:25:54 -050085
James E. King, IIIcfb01302017-11-11 09:39:19 -050086 # Delete all untagged images.
87 alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
jfarrelle03f7e82015-02-18 23:25:54 -050088
James E. King, IIIcfb01302017-11-11 09:39:19 -050089 # Delete all stopped containers and untagged images.
90 alias dockerclean='dockercleanc || true && dockercleani'
91
92 # Build a thrift docker image (run from top level of git repo): argument #1 is image type (ubuntu, centos, etc).
93 function dockerbuild
94 {
95 docker build -t $1 build/docker/$1
96 }
97
98 # Run a thrift docker image: argument #1 is image type (ubuntu, centos, etc).
99 function dockerrun
100 {
101 docker run -v $(pwd):/thrift/src -it $1 /bin/bash
102 }
103
James E. King IIIf5f430d2018-06-08 03:37:55 +0000104Then, to pull down the current image being used to build (the same way
105Travis CI does it) - if it is out of date in any way it will build a
106new one for you:
James E. King, IIIcfb01302017-11-11 09:39:19 -0500107
Thomasc890ed42024-02-25 19:58:30 +0900108 thrift$ DOCKER_REPO=thrift/thrift-build DISTRO=ubuntu-focal build/docker/refresh.sh
James E. King, IIIcfb01302017-11-11 09:39:19 -0500109
James E. King IIIf5f430d2018-06-08 03:37:55 +0000110To run all unit tests (just like Travis CI does):
James E. King, IIIcfb01302017-11-11 09:39:19 -0500111
Thomasc890ed42024-02-25 19:58:30 +0900112 thrift$ dockerrun thrift/thrift-build:ubuntu-focal
James E. King, IIIcfb01302017-11-11 09:39:19 -0500113 root@8caf56b0ce7b:/thrift/src# build/docker/scripts/autotools.sh
114
James E. King IIIf5f430d2018-06-08 03:37:55 +0000115To run the cross tests (just like Travis CI does):
James E. King, IIIcfb01302017-11-11 09:39:19 -0500116
Thomasc890ed42024-02-25 19:58:30 +0900117 thrift$ dockerrun thrift/thrift-build:ubuntu-focal
James E. King, IIIcfb01302017-11-11 09:39:19 -0500118 root@8caf56b0ce7b:/thrift/src# build/docker/scripts/cross-test.sh
119
120When you are done, you want to clean up occasionally so that docker isn't using lots of extra disk space:
121
122 thrift$ dockerclean
123
James E. King IIIf5f430d2018-06-08 03:37:55 +0000124You need to run the docker commands from the root of the local clone of the
125thrift git repository for them to work.
James E. King, IIIcfb01302017-11-11 09:39:19 -0500126
James E. King IIIf5f430d2018-06-08 03:37:55 +0000127When you are done in the root docker shell you can `exit` to go back to
128your user host shell. Once the unit tests and cross test passes locally,
129submit the changes, and if desired squash the pull request to one commit
130to make it easier to merge (the committers can squash at commit time now
131that GitHub is the master repository). Now you are building like Travis CI does!
James E. King, IIIcfb01302017-11-11 09:39:19 -0500132
133## Raw Commands for Building with Docker ##
134
135If you do not want to use the same scripts Travis CI does, you can do it manually:
136
137Build the image:
138
thomasbruggink5d0205d2024-11-05 15:33:18 +0900139Linux:
Thomasc890ed42024-02-25 19:58:30 +0900140
141 thrift$ docker build --build-arg uid=$(id -u) --build-arg gid=$(id -g) -t thrift build/docker/ubuntu-jammy
142
thomasbruggink5d0205d2024-11-05 15:33:18 +0900143Windows/Mac:
Thomasc890ed42024-02-25 19:58:30 +0900144
145 thrift$ docker build -t thrift build/docker/ubuntu-jammy
146
James E. King, IIIcfb01302017-11-11 09:39:19 -0500147
148Open a command prompt in the image:
149
150 thrift$ docker run -v $(pwd):/thrift/src -it thrift /bin/bash
jfarrelle03f7e82015-02-18 23:25:54 -0500151
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400152## Core Tool Versions per Dockerfile ##
153
Thomasf8431852024-03-05 23:21:05 +0900154Last updated: March 5, 2024
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400155
Jens Geyer94e1a302025-05-15 21:30:12 +0200156| Tool | ubuntu-focal | ubuntu-jammy | ubuntu-noble | Notes |
157| :-------- | :------------ | :------------ | :------------ | :---- |
158| ant | 1.10.7 | 1.10.12 | | |
159| autoconf | 2.69 | 2.71 | | |
160| automake | 1.16.1 | 1.16.5 | | |
161| bison | 3.5.1 | 3.8.2 | | |
162| boost | 1.71.0 | 1.74.0 | | |
163| cmake | 3.16.3 | 3.22.1 | | |
164| cppcheck | 1.90 | 2.7 | | |
165| flex | 2.6.4 | 2.6.4 | | |
166| libc6 | 2.31 | 2.35 | | glibc |
167| libevent | 2.0.16 | 2.0.16 | | |
168| libstdc++ | 10.5.0 | 10.5.0 | | |
169| make | 4.2.1 | 4.3 | | |
170| openssl | 1.1.1f | 3.0.2 | | |
171| qt5 | 5.12.8 | 5.15.3 | | |
James E. King, IIId7142b72017-09-01 13:00:36 -0700172
James E. King, IIIcd5be7b2017-10-21 10:16:19 -0400173## Compiler/Language Versions per Dockerfile ##
174
Jens Geyer94e1a302025-05-15 21:30:12 +0200175| Tool | ubuntu-focal | ubuntu-jammy | ubuntu-noble | Notes |
176| :-------- | :------------ | :------------ | :------------ | :---- |
177| as of | Mar 06, 2018 | Jul 1, 2019 | | |
178| as3 | 4.6.0 | 4.6.0 | | |
179| C++ gcc | 9.4.0 | 11.4.0 | | |
180| C++ clang | 13.0.0 | 13.0.0 | | |
181| c\_glib | 3.2.12 | 3.2.12 | | |
182| cl (sbcl) | | 1.5.3 | | |
183| d | 2.087.0 | 2.087.0 | | |
184| dart | 2.7.2-1 | 2.7.2-1 | | |
185| delphi | | | | Not in CI |
186| erlang | OTP-25.3.2.9 | OTP-25.3.2.9 | | |
187| go | 1.21.7 | 1.21.7 | | |
188| haxe | 4.2.1 | 4.2.1 | | |
189| java | 17 | 17 | | |
190| js | Node.js 16.20.2, npm 8.19.4 | | | Node.js 16.20.2, npm 8.19.4 |
191| lua | 5.2.4 | 5.2.4 | | Lua 5.3: see THRIFT-4386 |
192| netstd | 9.0 | 9.0 | 9.0 | |
193| nodejs | 16.20.2 | 16.20.2 | | |
194| ocaml | 4.08.1 | 4.13.1 | | |
195| perl | 5.30.0 | 5.34.0 | | |
196| php | 7.4.3 | 8.1.2 | 8.3 | |
197| python2 | 2.7.18 | | | |
198| python3 | 3.8.10 | 3.10.12 | | |
199| ruby | 2.7.0p0 | 3.0.2p107 | | |
200| rust | 1.83.0 | 1.83.0 | | |
201| smalltalk | | | | Not in CI |
202| swift | 5.7 | 5.7 | 6.1 | |