Finished CyMaIS Dockerfile setup base

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

View File

@ -1,38 +1,54 @@
FROM archlinux:latest
# 1) Update system and install build tools
# 1) Update system and install build tools + Go for AUR package builds
RUN pacman -Syu --noconfirm \
base-devel \
git \
make \
sudo \
python \
python-pip \
sudo \
go \
&& pacman -Scc --noconfirm
# 2) Define where our venv and repo will live
# 2) Create a non-root user for building AUR packages
RUN useradd -m builder
# 3) Clone & build yay as the unprivileged 'builder' user
USER builder
WORKDIR /home/builder
RUN git clone https://aur.archlinux.org/yay.git \
&& cd yay \
&& makepkg --noconfirm --skippgpcheck
# 4) Switch back to root to install the built yay package system-wide
USER root
RUN pacman -U --noconfirm /home/builder/yay/yay-*.pkg.tar.zst \
&& rm -rf /home/builder/yay
# 5) Define where our pkgmgr virtualenv and repo will live
ENV PKGMGR_VENV=/root/.venvs/pkgmgr
ENV PKGMGR_REPO=/opt/package-manager
# 3) Clone the package-manager sources
# 6) Clone the package-manager sources
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git $PKGMGR_REPO
# 4) Create the venv and install its Python requirements there
# 7) 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) 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 \
# 8) 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)
# 9) Ensure the venvs bin is first on PATH
ENV PATH="$PKGMGR_VENV/bin:${PATH}"
# 7) Now install CyMaIS via pkgmgr (all inside the venv)
# 10) Use pkgmgr (inside the venv) to install CyMaIS, allowing AUR dependencies via yay
RUN pkgmgr install cymais --clone-mode https
# 8) And ship the container as the cymais CLI
# 11) Expose the cymais CLI as the containers entrypoint
ENTRYPOINT ["cymais"]
CMD ["--help"]