|
| 1 | +# Apache Thrift Docker Official Image Packaging |
| 2 | + |
| 3 | +This directory contains the packaging for the Apache Thrift compiler Docker Official Image. |
| 4 | + |
| 5 | +The image is compiler-only. It contains the `thrift` compiler/code generator and the runtime libraries needed by that binary. It does not include language-specific Thrift runtime libraries or the contributor build images from `build/docker/*`. |
| 6 | + |
| 7 | +Do not push images from this repository. Public images are built and published by Docker Official Images after review in `docker-library/official-images`. |
| 8 | + |
| 9 | +## Usage |
| 10 | + |
| 11 | +Generate code from the current project directory: |
| 12 | + |
| 13 | +```console |
| 14 | +docker run --rm -u "$(id -u):$(id -g)" -v "$PWD:/data" thrift --gen py -o /data /data/service.thrift |
| 15 | +``` |
| 16 | + |
| 17 | +The `-u` flag prevents generated files in the bind mount from being owned by root. |
| 18 | + |
| 19 | +Run the compiler version check: |
| 20 | + |
| 21 | +```console |
| 22 | +docker run --rm thrift --version |
| 23 | +``` |
| 24 | + |
| 25 | +Use Alpine explicitly when you need the Alpine/musl variant: |
| 26 | + |
| 27 | +```console |
| 28 | +docker pull thrift:0.22-alpine |
| 29 | +``` |
| 30 | + |
| 31 | +## Files |
| 32 | + |
| 33 | +- `versions.json` records release artifact URLs, checksums, signer fingerprints, release dates, base versions, and maintenance state. |
| 34 | +- `0.22.0/Dockerfile` builds the Debian-based image for Thrift 0.22.0. |
| 35 | +- `0.22.0/Dockerfile.alpine` builds the Alpine-based image for Thrift 0.22.0. |
| 36 | +- `docker-entrypoint.sh` provides the CLI-friendly container entrypoint. |
| 37 | +- `tests/smoke.thrift` is the shared smoke-test fixture. |
| 38 | +- `generate-stackbrew-library.sh` prints Docker Library metadata for Bashbrew. |
| 39 | +- `generate-official-images-library.sh` writes that metadata to `tmp/` or to a local `docker-library/official-images` checkout. |
| 40 | + |
| 41 | +## Updating for a Release |
| 42 | + |
| 43 | +After the ASF release vote passes, release artifacts are promoted, and the website/download page is updated: |
| 44 | + |
| 45 | +```console |
| 46 | +cd docker |
| 47 | +./update.sh 0.23.0 |
| 48 | +./test.sh --all-platforms |
| 49 | +``` |
| 50 | + |
| 51 | +`update.sh` verifies the source tarball checksum and PGP signature, records the signer fingerprint, updates Dockerfile `ARG` values, and applies the two-latest-full-releases retention policy. |
| 52 | + |
| 53 | +Set base versions explicitly if needed: |
| 54 | + |
| 55 | +```console |
| 56 | +DEBIAN_VERSION=trixie ALPINE_VERSION=3.23 RELEASED_DATE=2025-05-14 ./update.sh 0.22.0 |
| 57 | +``` |
| 58 | + |
| 59 | +The script does not scrape the Thrift website. `RELEASED_DATE` is informational metadata. |
| 60 | + |
| 61 | +## Testing |
| 62 | + |
| 63 | +Run native-platform tests: |
| 64 | + |
| 65 | +```console |
| 66 | +cd docker |
| 67 | +./test.sh |
| 68 | +``` |
| 69 | + |
| 70 | +Run the supported platform matrix: |
| 71 | + |
| 72 | +```console |
| 73 | +cd docker |
| 74 | +./test.sh --all-platforms |
| 75 | +``` |
| 76 | + |
| 77 | +The full local matrix uses Buildx for `linux/amd64` and `linux/arm64`; arm64 tests require QEMU/binfmt support on non-arm64 hosts. Apache CI runs separate native `amd64` and `arm64` jobs. |
| 78 | + |
| 79 | +The tests build Debian and Alpine variants, verify the compiler version, exercise entrypoint behavior, generate JSON and Python output from `tests/smoke.thrift`, and check bind-mount output ownership on the native platform. |
| 80 | + |
| 81 | +## Docker Official Images |
| 82 | + |
| 83 | +Docker Official Images does not run the maintenance scripts in this directory. Its tooling reads `docker-library/official-images/library/thrift`, fetches each `GitCommit`, and builds the referenced `Directory` and `File` entries. |
| 84 | + |
| 85 | +After the Docker packaging commit is on Apache Thrift `master`, generate the submit-ready manifest into `tmp/`: |
| 86 | + |
| 87 | +```console |
| 88 | +./generate-official-images-library.sh |
| 89 | +``` |
| 90 | + |
| 91 | +Or write directly into a local `docker-library/official-images` checkout: |
| 92 | + |
| 93 | +```console |
| 94 | +./generate-official-images-library.sh /path/to/official-images/library/thrift |
| 95 | +``` |
| 96 | + |
| 97 | +Docker Library manifests are generated artifacts; they are not checked into this repository. |
| 98 | + |
| 99 | +Docker Hub documentation is maintained through `docker-library/docs`. |
| 100 | + |
| 101 | +## Release Rules |
| 102 | + |
| 103 | +- Only voted ASF releases may be used. |
| 104 | +- Do not publish release candidates, pre-releases, branch builds, nightlies, or continuous builds. |
| 105 | +- The Docker Official Image is a convenience artifact built from voted ASF source releases; it is not itself the ASF release artifact. |
| 106 | +- The Docker Official Image library tracks the two latest full Apache Thrift releases after Docker image maintenance is restored. Initial restoration starts with 0.22.0 only; 0.21.0 is not backfilled. |
| 107 | +- Older tags can remain pullable on Docker Hub after they are removed from the library file, but they are no longer rebuilt or maintained. |
0 commit comments