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

cross arch builds, upstream debian and yt/pipes fixes #6

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

spurin
Copy link
Contributor

@spurin spurin commented Dec 16, 2024

Hi @wernight,

Hope you're well, a blast from the past on this one! Whilst this is now an old project at close to 10 years, its one of my favourites for introducing people to containers and Docker! Thank you so much.

I've noticed recently, people experiencing problems when attempting to use this on Apple Silicon with the differences between the current amd64 image and arm/v8 needed for the newer Apple Silicon. In the past, it worked well, albeit with a warning and emulation but on more recent versions, it's been problematic.

I've been able to get this working by cross building for linux/386, amd64, arm64/v[6,7,8], ppc64le and s390x 😊

My mirror works as expected (spurin/funbox) however, ideally this is best served from your original image of wernight/funbox.

This PR has the changes I used to get this working and cross built. In summary:

  • Image changed from debian:jessie to debian
  • No need for the sid repository anymore, we can just install lolcat direct
  • Switched youtube-dl to yt-dlp and added ffmpeg
  • Added a cross compile build script as build.sh

The examples in the readme all work as expected including the YT one.

If you were happy to merge this, you should be able to run the build.sh from a modern version of Docker (I'm using Docker Desktop on Mac) to compile all of the variations and push an updated version image.

Hope this helps and great work on achieving 10 years with this awesome project!

Many Thanks

James

@spurin
Copy link
Contributor Author

spurin commented Dec 16, 2024

I pushed another update to this PR, I noticed the existing issue regarding pipes and have addressed this also, referencing the shell script from the upstream repository as per your feedback for that issue. Tested and working well.

image

This PR should also satisfy the requirements for Issue #5 to be closed.

In the GitHub repository, on the sidebar, the link could be updated from https://registry.hub.docker.com/u/wernight/funbox to https://registry.hub.docker.com/r/wernight/funbox (change the u to an r, guessing that this changed at some point on Docker Hub).

With the built image, it should hopefully be good to go!

@spurin spurin changed the title cross arch builds, upstream debian and yt fixes cross arch builds, upstream debian and yt/pipes fixes Dec 16, 2024
@wernight wernight merged commit 0fe4bb8 into wernight:master Dec 16, 2024
@spurin
Copy link
Contributor Author

spurin commented Dec 16, 2024

Hi @wernight

Possibly you're testing this at the moment but just in case it was missed in the context above, are you able to build this please using the build.sh script that was in my commit. Comparing my built version with the recent push on Docker Hub -

Currently supports amd64 only:

image

Supports multiple architectures:

image

This should allow all architectures to make use of the project transparently, I'm using it locally on Apple Silicon and it works great!

In case it was missed also, the repo target in the repository needs to be changed to https://registry.hub.docker.com/r/wernight/funbox rather than https://registry.hub.docker.com/r/wernight/funbox (change u to an r), the link is currently broken.

@wernight
Copy link
Owner

I ran the second command using podman as that's what I use. Is there an easy check to see that x86 works?

@spurin
Copy link
Contributor Author

spurin commented Dec 16, 2024

Hi @wernight, I can confirm that the amd64 image works but, apple silicon users and other arm users will get the error if it runs at all. This was what I was hoping we could avoid with multi-arch builds.

When I run this on apple silicon I get the following in the menu -

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
                         _       _     _      ____             _
__      _____ _ __ _ __ (_) __ _| |__ | |_   / / _|_   _ _ __ | |__   _____  __
\ \ /\ / / _ \ '__| '_ \| |/ _` | '_ \| __| / / |_| | | | '_ \| '_ \ / _ \ \/ /
 \ V  V /  __/ |  | | | | | (_| | | | | |_ / /|  _| |_| | | | | |_) | (_) >  <
  \_/\_/ \___|_|  |_| |_|_|\__, |_| |_|\__/_/ |_|  \__,_|_| |_|_.__/ \___/_/\_\
                           |___/

Screensavers / inifite animations:
  1) `aafire` - Fire pit
  2) `asciiquarium` - Aquarium
  3) `cacademo` - caca-utils demo
  4) `cmatrix` - Matrix
  5) `falling-hearts` - Falling Hearts screensaver
  6) `nyancat` - Nyan cat
  7) `pipes` - Pipes screensaver
  8) `xaos` - real-time interactive fractal zoomer
Demos / short animations:
  9) `bb` - ASCII art demo
 10) `sl` - Train passing by
 11) `youtube` - Alias to watch YouTube video using `youtube-dl`, `vlc` and `caca`

It's intermittent and for reasons I don't know, the emulation of amd64 under arm seems to be problematic for some with it failing completely. An arch build for arm/v8 like the one in the reference above runs natively as expected.

Sadly, podman/buildah doesn't have the multi-arch build capability and ease that Docker has with buildx.

@spurin
Copy link
Contributor Author

spurin commented Dec 16, 2024

It may be possible using github actions as an alternative to pushing this via docker locally. GPT generated but this seems to be a good starting block for a github action equivalent. Saving this as something like .github/workflows/build-and-push.yml in the repo.

name: Build and Push Docker image

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Log in to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: wernight/funbox:latest
          platforms: linux/386,linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/s390x

Secrets then added behind the scenes to the repo for DOCKER_USERNAME and DOCKER_PASSWORD, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants