diff --git a/Containerfile b/Containerfile index 607be48..dcbc0b7 100644 --- a/Containerfile +++ b/Containerfile @@ -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 " -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 diff --git a/extra-packages b/extra-packages deleted file mode 100644 index c676dba..0000000 --- a/extra-packages +++ /dev/null @@ -1,46 +0,0 @@ -bc -brew -busybox -bzip2 -ca-certificates-bundle -coreutils -curl -diffutils -direnv -findmnt -findutils -gawk -gnupg -gnutar -gpg -iproute2 -iputils -keyutils -less -libcap -man-db -mesa -mount -ncurses -ncurses-terminfo -net-tools -openssh-client -posix-libc-utils -procps -rsync -shadow -sed -sudo -tcpdump -tree -tzdata -umount -unzip -util-linux -util-linux-login -util-linux-misc -vim -wget -xauth -xz -zip diff --git a/aussielunix_Root_CA_168848365996868199089383065266162030969.crt b/files/aussielunix_Root_CA_168848365996868199089383065266162030969.crt similarity index 100% rename from aussielunix_Root_CA_168848365996868199089383065266162030969.crt rename to files/aussielunix_Root_CA_168848365996868199089383065266162030969.crt diff --git a/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh b/files/etc/profile.d/00-homebrew-firstrun.sh similarity index 96% rename from files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh rename to files/etc/profile.d/00-homebrew-firstrun.sh index bceca3f..b858815 100644 --- a/files/etc/profile.d/00-bluefin-cli-brew-firstrun.sh +++ b/files/etc/profile.d/00-homebrew-firstrun.sh @@ -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 diff --git a/files/etc/profile.d/bash_completion.sh b/files/etc/profile.d/bash_completion.sh deleted file mode 100644 index 910b484..0000000 --- a/files/etc/profile.d/bash_completion.sh +++ /dev/null @@ -1,42 +0,0 @@ -# shellcheck shell=sh disable=SC1090,SC1091,SC2039,SC2166,SC2268 -# Check for interactive bash and that we haven't already been sourced. -if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then - - # Check for recent enough version of bash. - if [ "${BASH_VERSINFO[0]}" -gt 4 ] || - [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 2 ]; then - [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && - . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" - if shopt -q progcomp && [ -d /usr/share/bash-completion/completions ]; then - for rc in /usr/share/bash-completion/completions/*; do - if test -r "$rc"; then - . "$rc" - fi - done - unset rc - fi - if shopt -q progcomp && [ -r /usr/local/share/bash-completion/bash_completion ]; then - # Source completion code. - . /usr/local/share/bash-completion/bash_completion - fi - if ! test -L /home/linuxbrew/.linuxbrew/etc/bash_completion.d/brew && test "$(id -u)" -gt 0; then - /home/linuxbrew/.linuxbrew/bin/brew completions link > /dev/null - fi - if test -d /home/linuxbrew/.linuxbrew/etc/bash_completion.d; then - for rc in /home/linuxbrew/.linuxbrew/etc/bash_completion.d/*; do - if test -r "$rc"; then - . "$rc" - fi - done - unset rc - fi - if test -d /run/host/etc/bash_completion.d; then - for rc in /run/host/etc/bash_completion.d/*; do - if test -r "$rc"; then - . "$rc" - fi - done - unset rc - fi - fi -fi diff --git a/files/etc/profile.d/command-not-found-host-exec.sh b/files/etc/profile.d/command-not-found-host-exec.sh deleted file mode 100644 index c7a6ff3..0000000 --- a/files/etc/profile.d/command-not-found-host-exec.sh +++ /dev/null @@ -1,14 +0,0 @@ -# shellcheck shell=sh -command_not_found_handle() { - # don't run if not in a container - if [ ! -e /run/.containerenv ] && [ ! -e /.dockerenv ]; then - exit 127 - fi - distrobox-host-exec "${@}" -} - -if [ -n "${ZSH_VERSION-}" ]; then - command_not_found_handler() { - command_not_found_handle "$@" - } -fi diff --git a/files/etc/profile.d/homebrew-env.sh b/files/etc/profile.d/homebrew-env.sh deleted file mode 100644 index 3bc4151..0000000 --- a/files/etc/profile.d/homebrew-env.sh +++ /dev/null @@ -1,10 +0,0 @@ -# shellcheck shell=sh - -PATH="$PATH:/home/linuxbrew/.linuxbrew/bin" -export PATH -HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew" -export HOMEBREW_REPOSITORY -HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" -export HOMEBREW_PREFIX -HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar" -export HOMEBREW_CELLAR diff --git a/files/etc/profile.d/homebrew.sh b/files/etc/profile.d/homebrew.sh new file mode 100644 index 0000000..167e37f --- /dev/null +++ b/files/etc/profile.d/homebrew.sh @@ -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 diff --git a/files/etc/profile.d/locale.sh b/files/etc/profile.d/locale.sh new file mode 100644 index 0000000..0062f23 --- /dev/null +++ b/files/etc/profile.d/locale.sh @@ -0,0 +1,2 @@ +LANG=en_AU.utf8 +export LANG diff --git a/files/extra-packages b/files/extra-packages new file mode 100644 index 0000000..465103b --- /dev/null +++ b/files/extra-packages @@ -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