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

Fix Failing Docker Builds #882

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Fix Failing Docker Builds #882

merged 1 commit into from
Aug 18, 2022

Conversation

frankhinek
Copy link
Contributor

Description

The Alpine Linux package repository no longer contains the fontforge package for x86 and ARM architectures in the edge/testing branch, as can be verified here:

https://pkgs.alpinelinux.org/packages?name=fontforge&branch=edge&repo=&arch=&maintainer=

This commit updates the nerdfonts/patcher Dockerfile to install the fontforge package from the edge/community branch to resolve the failing Docker builds.

Requirements / Checklist

What does this Pull Request (PR) do?

Modifies the Dockerfile so that the RUN command reads:

RUN apk update && apk upgrade && apk add --no-cache fontforge --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community && \
    apk add --no-cache py3-pip && \
    pip install configparser

How should this be manually tested?

  1. Clone the fix/docker-build branch of the frankhinek/nerd-fonts repo:

    git clone -b fix/docker-build --depth 1 https://github.com/frankhinek/nerd-fonts.git

    or manually patch the Dockerfile as specified above.

  2. Build the Docker container image:

    docker build -t nerdfonts/patcher .

Any background context you can provide?

The nerdfonts/patcher container image published to Docker Hub hasn't been updated for 8 months, so it would be great if, after the Docker Builds are succeeding, a new image can be pushed to Docker Hub.

The Alpine Linux package repository no longer contains the `fontforge` package for x86 and ARM architectures in the `edge/testing` branch.

This commit updates the Dockerfile to install the `fontforge` package from the `edge/community` branch to resolve the failing Docker builds.
@Finii Finii merged commit 7c5c4d7 into ryanoasis:master Aug 18, 2022
@Finii
Copy link
Collaborator

Finii commented Aug 18, 2022

Thank you!

I'm no docker expert at all. Will try after I get the ordinary release right.

@frankhinek
Copy link
Contributor Author

I'm no docker expert at all. Will try after I get the ordinary release right.

Wouldn't claim to be an expert but have 8+ years of experience working with Docker. Happy to be of assistance if any issues arise.

@Finii
Copy link
Collaborator

Finii commented Aug 18, 2022

I guess I have no rights regarding the docker container. I do not even have a docker hub account.

But it seems Ryan set this up to be automatically pushed when run?

jobs:
  publish-image:
    name: Publish image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build image
        run: docker build -t nerdfonts/patcher .
      - name: Push image
        run: |
          docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PAT }}
          docker push nerdfonts/patcher

@Finii
Copy link
Collaborator

Finii commented Aug 18, 2022

Wow, Alpine has already fontforge March 2022 Release which will fix some problems for users 👍

Wanted to change the release patching here (runs Ubuntu) also to March 2022, which seems like self-building.

@Finii
Copy link
Collaborator

Finii commented Aug 18, 2022

Did work 👍

Thanks again!

image

@frankhinek
Copy link
Contributor Author

I guess I have no rights regarding the docker container. I do not even have a docker hub account.

But it seems Ryan set this up to be automatically pushed when run?

jobs:
  publish-image:
    name: Publish image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build image
        run: docker build -t nerdfonts/patcher .
      - name: Push image
        run: |
          docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PAT }}
          docker push nerdfonts/patcher

@Finii Great to see that a GitHub Action is already in place to automatically push the new container image to Docker Hub!

An improvement I would suggest is to build Docker images for the most common architectures. The current GitHub action referenced above only builds images for amd64. As a result, anyone with an Apple M1/M2 Silicon macOS system will encounter an error similar to the following when they attempt to run patcher:

$ docker run -v $PWD/ttf:/in -v $PWD/ttf-nerd-font:/out nerdfonts/patcher:latest --complete
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Running with options:
 --complete

Since the DOCKER_USER and DOCKER_PAT secrets already exist, there should be no issue updating the GitHub Action workflows to build and push images for amd64 and arm64.

I'd be happy to write up and submit a PR if this is of interest.

Read What are multi-arch images? to learn more.

@Finii
Copy link
Collaborator

Finii commented Aug 18, 2022

You seem to be on an arm platform, so there would be at least one user who benefits from it.
So I'd say: Yes, please :-)

@frankhinek frankhinek deleted the fix/docker-build branch August 19, 2022 13:13
@Finii
Copy link
Collaborator

Finii commented Aug 22, 2022

Finally managed to get the container spin-up right and could test my newest changes.

image

Is there a way to debug inside the container, when something goes wrong? First I thought I broke font-patcher and would have liked to 'look' into the docker container... This docker-entrypoint script does not make it easier to debug 😬

@frankhinek
Copy link
Contributor Author

You seem to be on an arm platform, so there would be at least one user who benefits from it. So I'd say: Yes, please :-)

Great -- will get something worked up and submitted. Everyone on M1 or M2 Macs will run into this, so it'll be more users going forward.

@frankhinek
Copy link
Contributor Author

Finally managed to get the container spin-up right and could test my newest changes.

image

Is there a way to debug inside the container, when something goes wrong? First I thought I broke font-patcher and would have liked to 'look' into the docker container... This docker-entrypoint script does not make it easier to debug 😬

Yes, you can replace the ENTRYPOINT with a docker run flag:

docker run --entrypoint /bin/sh --rm -it nerdfonts/patcher:latest

@sammcj
Copy link
Contributor

sammcj commented Oct 27, 2022

Will be improved by #985

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.

3 participants