diff --git a/docs/docs/getting-started/installing-pants.mdx b/docs/docs/getting-started/installing-pants.mdx index c046d249de6..f1c8c615869 100644 --- a/docs/docs/getting-started/installing-pants.mdx +++ b/docs/docs/getting-started/installing-pants.mdx @@ -58,6 +58,21 @@ The `pants` launcher binary uses an embedded interpreter and does not rely on on We strongly recommend removing the `./pants` script from your repo and using the `pants` binary instead. You can keep a simple `./pants` script that delegates to `pants` to ease the transition. However, if you do need to continue to use the old installation method for some reason, please [let us know](/community/getting-help) so we can accommodate your use case in the launcher binary. ::: +## Installation in Docker / Containers +The standard installation method uses a installer-launcher that dynamically can install python versions and pants binaries depending on configuration. + +For container environments where a static or airtight installation is often important, you can install pants binaries directly. These are published in [github actions](https://github.com/pantsbuild/pants/releases). Here's a minimal docker example on how to do this with `uv`: +```dockerfile +FROM debian:bookworm-slim +COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/ +ENV NO_SCIE_WARNING=True +ENV PANTS_VERSION=2.30.0 +RUN UV_TOOL_BIN_DIR=/usr/local/bin UV_TOOL_DIR=/usr/local/share uv tool install \ + https://github.com/pantsbuild/pants/releases/download/release_${PANTS_VERSION}/pantsbuild_pants-${PANTS_VERSION}-cp311-cp311-manylinux2014_x86_64.whl \ + --python 3.11 +``` +You can avoid hardcoding wheel URLs and satisfy firewall constraints by uploading these pants wheels on your private [package indexes](https://docs.astral.sh/uv/concepts/indexes/) and use these as per `uv tool`'s documentation (i.e. using `uv tool --index-url`). + ## The `pants` binary's implementation You don't need to know this to use `pants`, but it may be of interest: