Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Refactor to use scripts #88

Merged
merged 5 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/build-boxkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
paths-ignore:
- '**/README.md'
env:
IMAGE_NAME: boxkit
IMAGE_TAGS: latest
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

Expand All @@ -25,7 +24,10 @@ jobs:
id-token: write
strategy:
fail-fast: false
steps:
matrix:
containerfile:
- boxkit
#- fedora-example # Included as an example to demonstrate multi-image builds, uncomment to build the fedora-example container too
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
uses: actions/checkout@v4
Expand All @@ -36,7 +38,7 @@ jobs:
id: meta
with:
images: |
${{ env.IMAGE_NAME }}
${{ matrix.containerfile }}
labels: |
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/boxkit/main/README.md

Expand All @@ -46,8 +48,8 @@ jobs:
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./Containerfile
image: ${{ env.IMAGE_NAME }}
./ContainerFiles/${{ matrix.containerfile }}
image: ${{ matrix.containerfile }}
tags: ${{ env.IMAGE_TAGS }}
labels: ${{ steps.meta.outputs.labels }}
oci: false
Expand Down Expand Up @@ -89,7 +91,7 @@ jobs:
- name: Sign container image
if: github.event_name != 'pull_request'
run: |
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ env.IMAGE_NAME }}@${TAGS}
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ steps.registry_case.outputs.lowercase }}/${{ matrix.containerfile }}@${TAGS}
env:
TAGS: ${{ steps.push.outputs.digest }}
COSIGN_EXPERIMENTAL: false
Expand Down
15 changes: 15 additions & 0 deletions ContainerFiles/boxkit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM quay.io/toolbx-images/alpine-toolbox:edge

LABEL com.github.containers.toolbox="true" \
usage="This image is meant to be used with the toolbox or distrobox command" \
summary="A cloud-native terminal experience" \
maintainer="[email protected]"

# Copy the setup scripts and package list
COPY ../scripts/boxkit.sh /
COPY ../scripts/distrobox-shims.sh /
COPY ../packages/boxkit.packages /

# Run the setup scripts
RUN chmod +x boxkit.sh distrobox-shims.sh && /boxkit.sh
RUN rm /boxkit.sh /distrobox-shims.sh /boxkit.packages
15 changes: 15 additions & 0 deletions ContainerFiles/fedora-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM quay.io/fedora/fedora-toolbox:latest

LABEL com.github.containers.toolbox="true" \
usage="This image is meant to be used with the toolbox or distrobox command" \
summary="An example ContainerFile to demonstrate multiple image builds." \
maintainer="[email protected]"

# Copy the setup scripts and package list
COPY ../scripts/fedora-sample.sh /
COPY ../scripts/distrobox-shims.sh /
COPY ../packages/fedora-example.packages /

# 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
20 changes: 0 additions & 20 deletions Containerfile

This file was deleted.

File renamed without changes.
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