Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker Container Image for pulp-cli #714

Open
luckylinux opened this issue Jan 20, 2025 · 4 comments
Open

Add Docker Container Image for pulp-cli #714

luckylinux opened this issue Jan 20, 2025 · 4 comments

Comments

@luckylinux
Copy link

Is your feature request related to a problem? Please describe.
I'd like to have pulp-cli available as a Container Image.

It seems to me (at least according to the Documentation) that it's only possible to installl pulp-cli from Source or from pip (pypi). There doesn't seem to be a Docker Container Image for it, at least, not that I could find. And pulp-minimal seems to contain several pulp-* Commands, but crucially NOT pulp. So e.g. pulp status will not work ...

Describe the solution you'd like
The best would probably be that it's done as part of your "general" pulp Framework.

I did a proof-of-concept but that is based on my Build Scripts (with a lot of commented lines to reduce Dependencies to a minimum) and the Docker Bases I usually use (Alpine and Debian), so it really looks (and is) completely different.

You can find the Repository here: https://github.com/luckylinux/docker-pulp-cli

Describe alternatives you've considered
Well this is the alternative to a Virtual Environment basically 😃.

Additional context
As said, probably better that somebody more familiar with the Container base used by pulp-oci-images implements this in "their framework", as my approach based on Alpine / Debian is probably too different.

The proof of Concept (I created a cli.toml File with the base Configuration, as per Documentation) seemed to work at least pulp status returned the expected Result.

@luckylinux luckylinux changed the title Add Image for pulp-cli Add Docker Container Image for pulp-cli Jan 20, 2025
@mdellweg
Copy link
Member

I just want to add, that we have packages in Fedora (not necessarily the newest version in anything but rawhide).
Also I have made some good experience with pipx (still a user based installation method...).

I can see the value for having a container with pulp-cli installed as the entrypoint. It could be a community addition.

Implementation considerations: I would base the image on some python:{debian,alpine,*} image and don't create another venv inside it. Also i think this should go as a single one off command container simply exiting itself after every command. Think: podman run --rm pulp-cli status. After all there is not state to be kept around.

@luckylinux
Copy link
Author

luckylinux commented Jan 21, 2025

Maybe ... As I said this is what I came up quickly basically Copy-Paste of my Template 🤣 . There might surely be other Ways to do it.

In MOST cases I usually use the alpine:latest or debian:bookworm Images as Base and I like to have at least bash around.

At least in 1 Case I indeed used python:3.12-alpine and python:3.12-bookworm, e.g.
https://github.com/luckylinux/docker-llm-benchmark/blob/main/Dockerfile-Alpine
https://github.com/luckylinux/docker-llm-benchmark/blob/main/Dockerfile-Debian

Not sure for alpine how much the difference really is. Pretty sure it's already quite a small Image.

You can for sure optimize 😃. This was just "what I usually do". It doesn't mean it can't be done with less space, complexity, etc. I just like it because it works for most cases and with the Cache it also reduces Build Time/Image Size. I usually fall back to the same "Standard" Structure I use everywhere (which can be debated, but I'm pretty happy in how it works), which is an Entrypoint Script which is "Killable" plus an App Launch Script which will get Killed when the Container gets Killed. This is to avoid that 10 Seconds Timeout or so.

Everybody has its Ways and Best Practices. I didn't use Multi-Stage (or Multi-Arch) Images yet, so of course that's another Improvement Point. I didn't learn how to do that yet though. There are many other People who are (much) more experienced than me with Containers. So, if there is a better Way (one can debate what "better" means eh 🤣), that one can also be used instead.

Folder Structure is of course Debatable, whether to use /opt or something else 🤣.

The Virtual Environment I also do as Standard, since at least on recent Versions of Debian/Ubuntu, pip really doesn't want you to install System-Wide to avoid Breakages. You can bypass this and disable the Message, but I still don't think it's too good to do (bad habits are difficult to get rid of after all).

After all there is not state to be kept around

Not a "State" per se provided you have mounted the Config Folder as a Bind-Mount Volume I guess 👍 .

@mdellweg
Copy link
Member

Yeah, there are at least as many ways to do things "right" in containers as there are people building containers.
This is no more than my personal opinion.

@vkukk
Copy link

vkukk commented Jan 30, 2025

I have created my own and running it in the same Pod as multiprocess pulp image.
Dockerfile

FROM python:3.12-slim

RUN /usr/bin/mkdir -p /root/.config/pulp
COPY .bashrc /root/.bashrc

# Install pipx
RUN pip install pipx

# Set PATH to access pipx-installed tools
ENV PATH="/root/.local/bin:$PATH"

# Install pulp-cli
RUN pipx install 'pulp-cli[pygments,shell]'

# Verify installation
RUN pulp --version

CMD ["tail", "-f", "/dev/null"]

.bashrc contains autocomplete
cli.toml is mounted into container as k8s configmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants