Skip to content

Commit

Permalink
Remove unnecessary user creation
Browse files Browse the repository at this point in the history
  • Loading branch information
smores56 committed Oct 18, 2024
1 parent 4edde4e commit bce3582
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ jobs:
with:
push: true
tags: smores56/smores-arch-toolbox:latest
cache-from: type=registry,ref=smores56/smores-arch-toolbox:buildcache
cache-to: type=registry,ref=smores56/smores-arch-toolbox:buildcache,mode=max
35 changes: 28 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
FROM docker.io/imrehg/archlinux-makepkg:latest
#########
# Builder
#########
FROM archlinux AS base

RUN pacman -Syuq --noconfirm git base-devel sudo

RUN echo "Defaults lecture = never" > /etc/sudoers.d/privacy \
&& echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/wheel

RUN useradd -m -G wheel builder && \
cd /home/builder && \
sudo -su builder git clone https://aur.archlinux.org/paru.git && \
sudo -su builder makepkg -s --noconfirm -D paru && \
mv * /tmp/paru && \
userdel builder -rf

#########
# Runtime
#########
FROM archlinux

LABEL com.github.containers.toolbox="true" \
name="smores-arch-toolbox" \
version="latest" \
usage="This image is meant to be used with the toolbox(1) command" \
summary="Image for creating Arch Toolbx containers"

RUN pacman -Syuq --noconfirm git base-devel sudo namcap openssh \
&& rm -rf /var/cache/pacman/pkg/*

COPY --from=base /tmp/paru/*.pkg.tar.* /tmp/pkg/

RUN sudo pacman -U --noconfirm /tmp/pkg/*.pkg.tar.*

# Install Arch packages
RUN yay -S --noconfirm --needed \
# terraform docker github-cli nixpkgs-fmt nil-git eza
Expand Down Expand Up @@ -36,9 +63,3 @@ RUN fnm install --lts && \
vscode-langservers-extracted \
graphql-language-service-cli \
dockerfile-language-server-nodejs

# Clear out /home
USER root
RUN sudo userdel -rf builder && \
sudo rm -rf /home/* /var/home/* && \
sudo mkdir /media

0 comments on commit bce3582

Please sign in to comment.