Optimized virtual environment und sudo

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-13 20:30:00 +02:00
parent 3c22fb8d36
commit 4c9ae52fd7
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E

View File

@ -1,25 +1,38 @@
FROM archlinux:latest
# 1) Update system and install required tools
# 1) Update system and install build tools
RUN pacman -Syu --noconfirm \
git \
make \
python \
python-pip \
&& pacman -Scc --noconfirm
git \
make \
python \
python-pip \
sudo \
&& pacman -Scc --noconfirm
# 2) Ensure ~/.local/bin is on PATH so pkgmgr & cymais are discoverable
ENV PATH="/root/.local/bin:${PATH}"
# 2) Define where our venv and repo will live
ENV PKGMGR_VENV=/root/.venvs/pkgmgr
ENV PKGMGR_REPO=/opt/package-manager
# 3) Clone and install Kevins Package Manager
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git /opt/package-manager \
&& cd /opt/package-manager \
&& make setup \
&& ln -s /opt/package-manager/main.py /usr/local/bin/pkgmgr
# 3) Clone the package-manager sources
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git $PKGMGR_REPO
# 4) Use pkgmgr to install CyMaIS
RUN pkgmgr install cymais
# 4) Create the venv and install its Python requirements there
RUN python -m venv $PKGMGR_VENV \
&& $PKGMGR_VENV/bin/pip install --upgrade pip \
&& $PKGMGR_VENV/bin/pip install --no-cache-dir -r $PKGMGR_REPO/requirements.txt
# 5) Default entrypoint to the cymais CLI
# 5) Write a tiny wrapper so `pkgmgr` always runs inside that venv
RUN printf '#!/bin/sh\n' > /usr/local/bin/pkgmgr \
&& printf '. %s/bin/activate\n' "$PKGMGR_VENV" >> /usr/local/bin/pkgmgr \
&& printf 'exec python %s/main.py "$@"\n' "$PKGMGR_REPO" >> /usr/local/bin/pkgmgr \
&& chmod +x /usr/local/bin/pkgmgr
# 6) Make sure any scripts in the venv get picked up (if there are any)
ENV PATH="$PKGMGR_VENV/bin:${PATH}"
# 7) Now install CyMaIS via pkgmgr (all inside the venv)
RUN pkgmgr install cymais --clone-mode https
# 8) And ship the container as the cymais CLI
ENTRYPOINT ["cymais"]
CMD ["--help"]