-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
playing with wrapping img in an image
- Loading branch information
Showing
2 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
.github/workflows/sensor-raspi-build-docker-wrap-push-ghcr.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: sensor-raspi-build-docker-wrap-push-ghcr | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- development | ||
paths: | ||
- 'sensor-raspi/**' | ||
- '.github/workflows/sensor-raspi-build-docker-wrap-push-ghcr.yml' | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
actions: write | ||
packages: write | ||
contents: read | ||
security-events: write | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- | ||
name: Cancel previous run in progress | ||
uses: styfle/[email protected] | ||
with: | ||
ignore_sha: true | ||
all_but_latest: true | ||
access_token: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: | | ||
image=moby/buildkit:master | ||
- | ||
name: Build environment setup | ||
run: | | ||
sudo apt-get -q update | ||
sudo env DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -q \ | ||
binfmt-support \ | ||
bmap-tools \ | ||
ca-certificates \ | ||
debootstrap \ | ||
dosfstools \ | ||
kpartx \ | ||
python3 \ | ||
qemu-user-static \ | ||
qemu-utils \ | ||
time \ | ||
vmdb2 \ | ||
zerofree | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Extract branch name | ||
shell: bash | ||
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
- | ||
name: Extract commit SHA | ||
shell: bash | ||
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
id: extract_commit_sha | ||
- | ||
name: Extract Malcolm version | ||
shell: bash | ||
run: echo "mversion=$(grep -P "^\s+image:.*/malcolm/" docker-compose.yml | awk '{print $2}' | cut -d':' -f2 | uniq -c | sort -nr | awk '{print $2}' | head -n 1)" >> $GITHUB_OUTPUT | ||
id: extract_malcolm_version | ||
- | ||
name: Build image | ||
run: | | ||
pushd ./sensor-raspi | ||
sudo make raspi_4_bookworm.img | ||
sudo chmod 644 ./raspi_4_bookworm*.* | ||
popd | ||
- | ||
name: ghcr.io login | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push IMG image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./sensor-raspi | ||
push: true | ||
tags: ghcr.io/${{ github.repository_owner }}/malcolm/hedgehog-raspi:${{ steps.extract_branch.outputs.branch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ghcr.io/mmguero/qemu-live-iso:latest | ||
|
||
# Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL org.opencontainers.image.authors='[email protected]' | ||
LABEL org.opencontainers.image.url='https://github.com/idaholab/Malcolm' | ||
LABEL org.opencontainers.image.documentation='https://github.com/idaholab/Malcolm/blob/main/sensor-iso/README.md' | ||
LABEL org.opencontainers.image.source='https://github.com/idaholab/Malcolm' | ||
LABEL org.opencontainers.image.vendor='Idaho National Laboratory' | ||
LABEL org.opencontainers.image.title='ghcr.io/idaholab/malcolm/hedgehog-raspi' | ||
LABEL org.opencontainers.image.description='Hedgehog Linux network sensor Raspberry Pi image wrapped in a Docker image' | ||
|
||
ARG QEMU_CPU=4 | ||
ARG QEMU_RAM=4096 | ||
ENV QEMU_CPU $QEMU_CPU | ||
ENV QEMU_RAM $QEMU_RAM | ||
|
||
ADD --chown=${DEFAULT_UID}:${DEFAULT_GID} https://raw.githubusercontent.com/idaholab/Malcolm/main/docs/images/hedgehog/logo/favicon.ico /image/favicon.ico | ||
ADD --chown=${DEFAULT_UID}:${DEFAULT_GID} raspi_4_bookworm*.* /image/ |