Move from docker compose run to a Python-managed container lifecycle. Each project now gets a dedicated container that is started on demand and stopped when opencode exits, instead of being recreated each time. Use a shared home directory across projects so configurations presist. The container are not destroyed, so tools and caches can be installed specifically for a project by opencode itself once and reused, while still avoiding long-running containers.
29 lines
693 B
Docker
29 lines
693 B
Docker
FROM archlinux:latest
|
|
|
|
ARG USERNAME=dev
|
|
ARG UID=1000
|
|
ARG GID=1000
|
|
|
|
RUN pacman -Syu --noconfirm \
|
|
base-devel \
|
|
git \
|
|
ca-certificates \
|
|
bash \
|
|
less \
|
|
ripgrep \
|
|
sudo && \
|
|
groupadd -g ${GID} ${USERNAME} && \
|
|
useradd -m -u ${UID} -g ${GID} -s /bin/bash ${USERNAME} && \
|
|
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
|
pacman -Scc --noconfirm
|
|
|
|
WORKDIR /tmp
|
|
USER ${USERNAME}
|
|
|
|
RUN git clone https://aur.archlinux.org/opencode-bin.git && \
|
|
cd opencode-bin && \
|
|
makepkg --syncdeps --noconfirm --install && \
|
|
sudo rm -rf /tmp/opencode-bin && \
|
|
sudo pacman -Scc --noconfirm
|
|
|
|
WORKDIR /home/${USERNAME}
|