Hello everyone, is there a way to install Pants wi...
# general
r
Hello everyone, is there a way to install Pants without the
pants
script? Or maybe an already built Pants Docker image (I can't seem to find one)? I ask because we are using Concourse CI and I want to create a Docker image with Pants pre-installed.
πŸ‘€ 1
w
I'm very invested in the solution to this too. What have you tried, and why doesn't it work?
I tried making a VS Code workspace essentially (dockerized container that VSCode uses automatically) so that I could do easier remote dev, but I was very new to Pants and it failed for some reason. However, in thinking about it, I don't know why it shouldn't work if you use pants as an entrypoint.. ... Will experiment and be back shortly
r
Thank you for your help. For now, I'm still figuring out what is the best way to run my tests with Pants in Concourse CI so I haven't start anything yet...
w
Ah, okay - I'm running some ideas right now, this is a problem I needed to solve a while ago and completely forgot! I'll report back if I get anywhere useful
πŸ‘ 1
ok, turns out previous me might just have been a simpleton - it works fine just doing the most obvious stuff.
git clone git@github.com:pantsbuild/example-python.git
And in there, create this Dockerfile:
Copy code
FROM python:3.9-bullseye
WORKDIR /app
COPY . /app
CMD ["bash"]
And then build and then
docker run image-name /app/pants lint ::
The optimizations are around storing/caching the Pants cache maybe, so it doesn't re-download each time, so maybe a base Pants 2.x.y image, and then keep the Pants cache as a volume
πŸ™Œ 1
If there is a good docker pattern, might be worth having some official Docker images for those teams who use docker to keep their devs in sync. I have a bunch of Dockerfiles I use against my source working directory (as a volume) or just use as full blown dev environments, and it can streamline a lot of headaches on Mac (building the Linux kernel, anyone?)
h
cc @ancient-vegetable-10556, who is looking into alternative installation approaches πŸ™‚
a
Hi! I am currently exploring whether we can make Pants work as a standalone binary. It’s interesting
πŸ‘€ 1
r
@wide-midnight-78598 The problem I see with this Dockerfile, is that it bootstraps Pants every time you run a command...
p
this may help: https://gist.github.com/asherf/a71eba185c900f47b82007470dc377d1 There are basically 3 files, pants bootstrap script and a docker file used to prepare pants in the container during the container build process. and a modified lightweight pants script (that should be in the repo) that will use that bootstrapped version and will break if it is not there. Hope it helps.
r
Wow, good job!
w
The problem I see with this Dockerfile, is that it bootstraps Pants every time you run a command.
Yeah for sure, that's what I mentioend above - doesn't cache anything. Previously when I tried something like this, errors were thrown What Asher did was what I was recommending. Essentially, cache all that setup. I was also recommending creating a volume to cache the results of the lockfiles being downloaded and installed too, so that way you can save a step (probably less of a concern in CI?)
πŸ‘ 1
r
Ok, sorry for my misunderstanding. By caching, I thought you meant caching the results of process execution...
w
In re-reading what I wrote, I was super ambiguous πŸ™‚