Skip to content

Commit

Permalink
big cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aussielunix committed Sep 8, 2024
1 parent 7bd7f3e commit bf0933f
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 144 deletions.
54 changes: 23 additions & 31 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
ARG SOURCE_IMAGE_NAME="${SOURCE_IMAGE_NAME:-wolfi-base}"
ARG SOURCE_IMAGE_REGISTRY="${SOURCE_IMAGE_REGISTRY:-cgr.dev/chainguard}"
ARG SOURCE_IMAGE="${SOURCE_IMAGE_REGISTRY}/${SOURCE_IMAGE_NAME}"

FROM $SOURCE_IMAGE:latest
FROM cgr.dev/chainguard/wolfi-base:latest

LABEL com.github.containers.toolbox="true" \
usage="This image is meant to be used with the Toolbox or Distrobox commands" \
summary="A new cloud-native terminal experience powered by Wolfi and Homebrew" \
maintainer="Mick Pollard <[email protected]>"

COPY ./extra-packages /toolbox-packages
COPY ./files /

# Update image, Install Packages, and move /home/linuxbrew
# Update image && Install some packages
RUN apk update && \
apk upgrade && \
grep -v '^#' /toolbox-packages | xargs apk add && \
grep -v '^#' /extra-packages | xargs apk add && \
rm /extra-packages && \
mv /home/linuxbrew /home/homebrew && \
rm /toolbox-packages
echo "#!/bin/sh" >> /usr/bin/pinentry && \
echo "exit 0" >> /usr/bin/pinentry && \
chmod +x /usr/bin/pinentry

# Install custom CA cert
COPY aussielunix_Root_CA_168848365996868199089383065266162030969.crt /
RUN cat /aussielunix_Root_CA_168848365996868199089383065266162030969.crt >> /etc/ssl/certs/ca-certificates.crt \
&& rm -f /aussielunix_Root_CA_168848365996868199089383065266162030969.crt

# Get Distrobox-host-exec and host-spawn
RUN git clone https://github.com/89luca89/distrobox.git --single-branch /tmp/distrobox && \
cp /tmp/distrobox/distrobox-host-exec /usr/bin/distrobox-host-exec && \
cp /tmp/distrobox/distrobox-export /usr/bin/distrobox-export && \
cp /tmp/distrobox/distrobox-init /usr/bin/entrypoint && \
wget https://github.com/1player/host-spawn/releases/download/$(cat /tmp/distrobox/distrobox-host-exec | grep host_spawn_version= | cut -d "\"" -f 2)/host-spawn-$(uname -m) -O /usr/bin/host-spawn && \
chmod +x /usr/bin/host-spawn && \
rm -drf /tmp/distrobox && \
ln -fs /bin/sh /usr/bin/sh

#RUN git clone https://github.com/89luca89/distrobox.git --single-branch /tmp/distrobox && \
# cp /tmp/distrobox/distrobox-host-exec /usr/bin/distrobox-host-exec && \
# cp /tmp/distrobox/distrobox-export /usr/bin/distrobox-export && \
# cp /tmp/distrobox/distrobox-init /usr/bin/entrypoint && \
# wget https://github.com/1player/host-spawn/releases/download/$(cat /tmp/distrobox/distrobox-host-exec | grep host_spawn_version= | cut -d "\"" -f 2)/host-spawn-$(uname -m) -O /usr/bin/host-spawn && \
# chmod +x /usr/bin/host-spawn && \
# rm -drf /tmp/distrobox && \
# ln -fs /bin/sh /usr/bin/sh

# Enable password less sudo
# using sudoers instead of toolbox filename here, so that in case of rootful
# distroboxes, the NOPASSWD can be deactivated for security reasons.
RUN echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudoers

# Copy the os-release file
RUN cp -p /etc/os-release /usr/lib/os-release

# Configure Locales and get bash-prexec
RUN mkdir -p /usr/share/ \
&& printf 'LANG=en_AU.utf8\nexport LANG\n' > /etc/profile.d/locale.sh \
&& printf 'LANG="en_AU.UTF-8"' > /etc/locale.conf
# Make some symlinks
RUN mkdir -p /usr/local/bin && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/docker && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/flatpak && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/rpm-ostree

# Change root shell to BASH
RUN sed -i -e '/^root/s/\/bin\/ash/\/bin\/bash/' /etc/passwd

# Delete nonroot user
RUN userdel nonroot && rm -rf /home/nonroot /etc/profile.d/brew.sh
46 changes: 0 additions & 46 deletions extra-packages

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ if test "$(id -u)" -gt "0"; then

if test ! -f /etc/linuxbrew.firstrun; then
sudo touch /etc/linuxbrew.firstrun
printf "\nMyToolbox first run complete!\n\n"
printf "\nBluefin-CLI first run complete!\n\n"
fi
fi
42 changes: 0 additions & 42 deletions files/etc/profile.d/bash_completion.sh

This file was deleted.

14 changes: 0 additions & 14 deletions files/etc/profile.d/command-not-found-host-exec.sh

This file was deleted.

10 changes: 0 additions & 10 deletions files/etc/profile.d/homebrew-env.sh

This file was deleted.

3 changes: 3 additions & 0 deletions files/etc/profile.d/homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export PATH="/home/linuxbrew/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:$PATH"
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_AUTO_UPDATE=1
2 changes: 2 additions & 0 deletions files/etc/profile.d/locale.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LANG=en_AU.utf8
export LANG
87 changes: 87 additions & 0 deletions files/extra-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
alpine-keys
apk-tools
bash
bc
binutils
binutils-gold
brew=4.3.18-r0
bubblewrap
build-base
busybox
bzip2
ca-certificates-bundle
coreutils
curl
diffutils
expat
findmnt
findutils
gcc
git
glibc
glibc-dev
glibc-locale-posix
gmp
gnupg
go
gpg
iproute2
iputils
isl
keyutils
less
libbrotlicommon1
libbrotlidec1
libcap
libcap-utils
libcrypto3
libcurl-openssl4
libgcc
libice
libnghttp2-14
libpcre2-32-0
libsm
libssl3
libstdc++
libstdc++-dev
libx11
libxau
libxcb
libxdmcp
libxext
libxmu
libxt
linux-headers
linux-pam
make
man-db
mount
mpc
mpfr
ncurses
ncurses-terminfo
ncurses-terminfo-base
net-tools
openssh-client
pigz
pkgconf
posix-libc-utils
procps
rsync
sed
shadow
sudo
tcpdump
tree
tzdata
umount
unzip
util-linux
util-linux-misc
vim
wget
wolfi-baselayout
xauth
xz
zip
zlib

0 comments on commit bf0933f

Please sign in to comment.