mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 11:01:31 +01:00
dockerfile: cleanup/improvements
This commit is contained in:
parent
a275d1fefc
commit
904f53b0e0
43
Dockerfile
43
Dockerfile
|
@ -20,39 +20,30 @@ RUN pacman --noconfirm -Syu && pacman --noconfirm -Sy \
|
|||
# Enable colors in pacman
|
||||
RUN sed -i 's/^#Color/Color/' /etc/pacman.conf
|
||||
|
||||
FROM base as yay_builder
|
||||
FROM base as builder
|
||||
|
||||
# prepare nobody makepkg user
|
||||
RUN mkdir /home/build && \
|
||||
chgrp nobody /home/build && \
|
||||
chmod g+ws /home/build && \
|
||||
setfacl -m u::rwx,g::rwx /home/build && \
|
||||
setfacl -d --set u::rwx,g::rwx,o::- /home/build
|
||||
# Cannot run makepkg as root: add build user
|
||||
RUN useradd build && echo "build ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
RUN sudo pacman -Sy --noconfirm go && rm -rf /var/cache/pacman/pkg/*
|
||||
USER build
|
||||
|
||||
# Cannot run makepkg as root
|
||||
USER nobody
|
||||
|
||||
RUN git clone https://aur.archlinux.org/yay.git /home/build/yay
|
||||
# yay (pre-compiled) and bretellofier
|
||||
WORKDIR /home/build/yay
|
||||
RUN env GOCACHE=/home/build makepkg
|
||||
RUN git clone https://aur.archlinux.org/yay-bin.git /home/build/yay && \
|
||||
git clone https://aur.archlinux.org/bretellofier.git /home/build/bretellofier && \
|
||||
cd /home/build/yay && env GOCACHE=/home/build makepkg --syncdeps --noconfirm && \
|
||||
cd /home/build/bretellofier && makepkg --syncdeps --noconfirm
|
||||
|
||||
USER root
|
||||
RUN pacman --noconfirm -U /home/build/yay/*zst
|
||||
|
||||
FROM base as final
|
||||
WORKDIR /root
|
||||
|
||||
RUN pacman -Sy --noconfirm zsh
|
||||
RUN chsh -s /bin/zsh
|
||||
RUN pacman -Sy --noconfirm zsh && chsh -s /bin/zsh
|
||||
|
||||
COPY --from=yay_builder /home/build/yay/*zst /tmp/
|
||||
COPY --from=builder /home/build/yay/*zst /tmp/
|
||||
COPY --from=builder /home/build/bretellofier/*zst /tmp/
|
||||
RUN pacman --noconfirm -U /tmp/*zst && rm -rf /tmp/*zst
|
||||
|
||||
# telegram notifications
|
||||
RUN yay -S bretellofier
|
||||
|
||||
# antibody
|
||||
RUN curl -sL https://git.io/antibody | sh -s - -b /usr/local/bin
|
||||
|
||||
|
@ -65,15 +56,15 @@ COPY . ${DOTFILES}
|
|||
|
||||
WORKDIR /root/
|
||||
|
||||
RUN echo "source $DOTFILES/brethil_dotfile.sh" >> .zshrc
|
||||
RUN ln -s $DOTFILES/vim/vimrc .vimrc
|
||||
RUN ln -s $DOTFILES/tmux.conf .tmux.conf
|
||||
RUN echo -e "[include]\npath = $DOTFILES/gitconfig" >> .gitconfig
|
||||
RUN echo -e "export DOTFILES=/root/.dotfiles\nsource \$DOTFILES/brethil_dotfile.sh" >> .zshrc && \
|
||||
ln -s $DOTFILES/vim/vimrc .vimrc && \
|
||||
ln -s $DOTFILES/tmux.conf .tmux.conf && \
|
||||
echo -e "[include]\npath = $DOTFILES/gitconfig" >> .gitconfig
|
||||
|
||||
# Install vim plugins
|
||||
RUN vim -c 'PlugInstall|qa!'
|
||||
|
||||
# Install zsh plugins
|
||||
RUN zsh -il -c exit
|
||||
RUN zsh -c exit
|
||||
|
||||
CMD tmux
|
||||
|
|
Loading…
Reference in New Issue
Block a user