diff --git a/.github/workflows/build-font-builder-docker-image.yml b/.github/workflows/build-font-builder-docker-image.yml new file mode 100644 index 0000000000..856a41a959 --- /dev/null +++ b/.github/workflows/build-font-builder-docker-image.yml @@ -0,0 +1,46 @@ + +name: Create and publish a Docker image + +on: + push: + branches: ['master', 'docker-build-*'] + paths: + - helpers/docker/** + +env: + REGISTRY: ghcr.io + REGISTRY_OWNER: jeppeklitgaard + IMAGE_NAME: font_builder + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: "helpers/docker" + file: "helpers/docker/font_builder.Dockerfile" + push: true + tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/helpers/docker/font_builder.Dockerfile b/helpers/docker/font_builder.Dockerfile new file mode 100644 index 0000000000..04da25178f --- /dev/null +++ b/helpers/docker/font_builder.Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.11-slim-bullseye + +LABEL org.opencontainers.image.url="https://openmoji.org/" +LABEL org.opencontainers.image.source="https://github.com/hfg-gmuend/openmoji" +LABEL org.opencontainers.image.title="OpenMoji Font Builder" +LABEL org.opencontainers.image.description="Builds OpenMoji color fonts" + +# This image is used to build fonts using nanoemoji and process them using woff2 + +# We need xmlstarlet +# We need GCC +# Remove pip git branch install and git dependency once https://github.com/googlefonts/picosvg/pull/279 is merged +RUN apt update \ + && apt install -y --no-install-recommends xmlstarlet woff2 \ + && apt install -y --no-install-recommends git \ + && apt install -y --no-install-recommends gcc g++ \ + && rm -rf /var/lib/apt/lists/* \ + && pip install --no-cache-dir nanoemoji==0.15.0 \ + && pip install --no-cache-dir git+https://github.com/JeppeKlitgaard/picosvg.git@fix-assert-line-length \ + && apt purge -y --auto-remove git \ + && apt purge -y --auto-remove gcc g++