https://pantsbuild.org/ logo
#general
Title
# general
c

crooked-lawyer-77407

03/06/2023, 6:00 AM
Has anyone been able to setup a dockerfile with pants? Want to run pants once to cache the downloaded binary in the container, but it requires a pyproject.toml that isn't in the container yet, trying to avoid hack-y things like temporary pyproject.toml files.
e

enough-analyst-54434

03/06/2023, 6:04 AM
What do you want cached? Just the pants binary, or the pants binary and a specific Pants version too? I.E. Do you just want scie-pants (
pants
) cached, or Pants 2.15.0 too?
This gets you both cached - for example:
Copy code
FROM ubuntu:22.04

RUN apt update && apt install -y curl

ARG SCIE_PANTS_VERSION=0.5.3
RUN curl \
    --proto '=https' \
    --tlsv1.2 \
    -fsSLO <https://static.pantsbuild.org/setup/get-pants.sh> && \
    bash get-pants.sh --bin-dir /usr/bin --base-name pants --version $SCIE_PANTS_VERSION && \
    rm get-pants.sh

ARG PANTS_VERSION=2.15.0
RUN touch BUILDROOT && \
    PANTS_VERSION=$PANTS_VERSION pants -V && \
    rm BUILDROOT
🙌 1
c

crooked-lawyer-77407

03/06/2023, 10:27 AM
I'm not up to date on what SCIE Pants is, I did hear about SCIE in the Pants blog post though (I'm using the new pants installer that contains the python interpreter, which I believe to be a SCIE). Is SCIE Pants something different from Pants?
My reason for doing all this is that the environment for this container will have no internet access, so no remote accessing of files can be done.
c

curved-television-6568

03/06/2023, 1:27 PM
scie-pants is the new launcher binary for running pants.
i.e. you install scie-pants on your system once, and use it for all your pants projects.
11 Views