Skip to content

Commit

Permalink
feat: Refactor to use scripts (#88)
Browse files Browse the repository at this point in the history
* Refactor to allow multiple image builds

* Don't build fedora-example

* Refactor to use scripts and packagelists

---------

Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com>
  • Loading branch information
faeizmahrus and castrojo authored Dec 25, 2024
1 parent c9f566d commit b115bfd
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-boxkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
containerfile:
- boxkit
#- fedora-example # <<- Included as an example to demonstrate multi-image builds, uncomment to build
#- fedora-example # Included as an example to demonstrate multi-image builds, uncomment to build the fedora-example container too
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
Expand Down
19 changes: 7 additions & 12 deletions ContainerFiles/boxkit
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ LABEL com.github.containers.toolbox="true" \
summary="A cloud-native terminal experience" \
maintainer="jorge.castro@gmail.com"

COPY ../packages/boxkit-packages /
RUN apk update && \
apk upgrade && \
grep -v '^#' /boxkit-packages | xargs apk add
RUN rm /boxkit-packages
# Copy the setup scripts and package list
COPY ../scripts/boxkit.sh /
COPY ../scripts/distrobox-shims.sh /
COPY ../packages/boxkit.packages /

RUN ln -fs /bin/sh /usr/bin/sh && \
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 && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update

# Run the setup scripts
RUN chmod +x boxkit.sh distrobox-shims.sh && /boxkit.sh
RUN rm /boxkit.sh /distrobox-shims.sh /boxkit.packages
17 changes: 7 additions & 10 deletions ContainerFiles/fedora-example
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ LABEL com.github.containers.toolbox="true" \
summary="An example ContainerFile to demonstrate multiple image builds." \
maintainer="faeizmahrus@outlook.com"

COPY ../packages/fedora-example-packages /
RUN dnf update -y && \
grep -v '^#' /fedora-example-packages | xargs dnf install -y
RUN rm /fedora-example-packages
# Copy the setup scripts and package list
COPY ../scripts/fedora-sample.sh /
COPY ../scripts/distrobox-shims.sh /
COPY ../packages/fedora-example.packages /

RUN ln -fs /bin/sh /usr/bin/sh && \
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 && \
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update
# Run the setup scripts
RUN chmod +x fedora-example.sh distrobox-shims.sh && /fedora-example.sh
RUN rm /fedora-example.sh /distrobox-shims.sh /fedora-example.packages
30 changes: 30 additions & 0 deletions packages/boxkit.packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
age
atuin
btop
bat
chezmoi
clipboard
cosign
dbus-x11
direnv
eza
ffmpeg
fzf
github-cli
helix
just
make
micro
ncdu
ncurses
neovim
npm
plocate
python3
ripgrep
speedtest-cli
starship
vimdiff
wl-clipboard
zellij
zstd
1 change: 1 addition & 0 deletions packages/fedora-example.packages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
helix
8 changes: 8 additions & 0 deletions scripts/boxkit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Symlink distrobox shims
./distrobox-shims.sh

# Update the container and install packages
apk update && apk upgrade
grep -v '^#' ./boxkit.packages | xargs apk add
8 changes: 8 additions & 0 deletions scripts/distrobox-shims.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

ln -fs /bin/sh /usr/bin/sh
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
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update
8 changes: 8 additions & 0 deletions scripts/fedora-example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Symlink distrobox shims
./distrobox-shims.sh

# Update the container and install packages
dnf update -y
grep -v '^#' ./fedora-example.packages | xargs dnf install -y

0 comments on commit b115bfd

Please sign in to comment.