Skip to content

Commit b115bfd

Browse files
feat: Refactor to use scripts (#88)
* 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>
1 parent c9f566d commit b115bfd

File tree

8 files changed

+70
-23
lines changed

8 files changed

+70
-23
lines changed

.github/workflows/build-boxkit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
containerfile:
3030
- boxkit
31-
#- fedora-example # <<- Included as an example to demonstrate multi-image builds, uncomment to build
31+
#- fedora-example # Included as an example to demonstrate multi-image builds, uncomment to build the fedora-example container too
3232
steps:
3333
# Checkout push-to-registry action GitHub repository
3434
- name: Checkout Push to Registry action

ContainerFiles/boxkit

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@ LABEL com.github.containers.toolbox="true" \
55
summary="A cloud-native terminal experience" \
66
maintainer="jorge.castro@gmail.com"
77

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

14-
RUN ln -fs /bin/sh /usr/bin/sh && \
15-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/docker && \
16-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/flatpak && \
17-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman && \
18-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/rpm-ostree && \
19-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update
20-
13+
# Run the setup scripts
14+
RUN chmod +x boxkit.sh distrobox-shims.sh && /boxkit.sh
15+
RUN rm /boxkit.sh /distrobox-shims.sh /boxkit.packages

ContainerFiles/fedora-example

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ LABEL com.github.containers.toolbox="true" \
55
summary="An example ContainerFile to demonstrate multiple image builds." \
66
maintainer="faeizmahrus@outlook.com"
77

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

13-
RUN ln -fs /bin/sh /usr/bin/sh && \
14-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/docker && \
15-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/flatpak && \
16-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman && \
17-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/rpm-ostree && \
18-
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update
13+
# Run the setup scripts
14+
RUN chmod +x fedora-example.sh distrobox-shims.sh && /fedora-example.sh
15+
RUN rm /fedora-example.sh /distrobox-shims.sh /fedora-example.packages

packages/boxkit.packages

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
age
2+
atuin
3+
btop
4+
bat
5+
chezmoi
6+
clipboard
7+
cosign
8+
dbus-x11
9+
direnv
10+
eza
11+
ffmpeg
12+
fzf
13+
github-cli
14+
helix
15+
just
16+
make
17+
micro
18+
ncdu
19+
ncurses
20+
neovim
21+
npm
22+
plocate
23+
python3
24+
ripgrep
25+
speedtest-cli
26+
starship
27+
vimdiff
28+
wl-clipboard
29+
zellij
30+
zstd

packages/fedora-example.packages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
helix

scripts/boxkit.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Symlink distrobox shims
4+
./distrobox-shims.sh
5+
6+
# Update the container and install packages
7+
apk update && apk upgrade
8+
grep -v '^#' ./boxkit.packages | xargs apk add

scripts/distrobox-shims.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
ln -fs /bin/sh /usr/bin/sh
4+
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/docker
5+
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/flatpak
6+
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman
7+
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/rpm-ostree
8+
ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/transactional-update

scripts/fedora-example.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# Symlink distrobox shims
4+
./distrobox-shims.sh
5+
6+
# Update the container and install packages
7+
dnf update -y
8+
grep -v '^#' ./fedora-example.packages | xargs dnf install -y

0 commit comments

Comments
 (0)