Skip to content

Commit

Permalink
feat: shrink image size by removing cached packages
Browse files Browse the repository at this point in the history
  • Loading branch information
m2Giles committed Oct 18, 2024
1 parent 7d1b978 commit 9f3784c
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN sed -i 's/#Color/Color/g' /etc/pacman.conf && \
pacman -Syu --noconfirm && \
useradd -m --shell=/bin/bash build && usermod -L build && \
echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
pacman -S --clean --clean

# Distrobox Integration
RUN git clone https://github.com/89luca89/distrobox.git --single-branch /tmp/distrobox && \
Expand Down Expand Up @@ -64,7 +65,8 @@ RUN pacman -S \
vulkan-intel \
vte-common \
vulkan-radeon \
--noconfirm
--noconfirm && \
rm -rf /var/cache/pacman/pkg/*

# Add paru and install AUR packages
USER build
Expand All @@ -86,32 +88,33 @@ RUN sed -i 's@#en_US.UTF-8@en_US.UTF-8@g' /etc/locale.gen && \
rm -drf /home/build && \
sed -i '/build ALL=(ALL) NOPASSWD: ALL/d' /etc/sudoers && \
sed -i '/root ALL=(ALL) NOPASSWD: ALL/d' /etc/sudoers && \
rm -rf \
/tmp/* \
/var/cache/pacman/pkg/*
rm -rf /tmp/*

FROM arch-distrobox AS arch-distrobox-amdgpupro

# Install amdgpu-pro, remove other drivers
RUN pacman -R \
libglvnd \
vulkan-intel \
vulkan-radeon \
mesa \
--noconfirm && \
useradd -m --shell=/bin/bash build && usermod -L build && \
RUN useradd -m --shell=/bin/bash build && usermod -L build && \
echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER build
WORKDIR /home/build
RUN paru -S \
RUN paru -R \
libglvnd \
vulkan-intel \
vulkan-radeon \
mesa \
--noconfirm && \
paru -Syu \
amdgpu-pro-oglp \
lib32-amdgpu-pro-oglp \
vulkan-amdgpu-pro \
lib32-vulkan-amdgpu-pro \
amf-amdgpu-pro \
--noconfirm
--noconfirm && \
sudo rm -rf /var/cache/pacman/pkg/* && \
rm -rf /home/build/.cache/*

USER root
WORKDIR /

Expand Down

0 comments on commit 9f3784c

Please sign in to comment.