1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-01-25 03:32:02 +02:00

Merge pull request #449 from mdschweda/feature-docker-support

Docker support
This commit is contained in:
Ryan L McIntyre 2021-04-19 21:39:09 -07:00 committed by GitHub
commit 0d9f3dc84a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 1 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
**
!src/glyphs/*.*
!font-patcher
!bin/scripts/docker-entrypoint.sh

25
.github/workflows/docker-release.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Docker release
on:
push:
branches:
- master
paths:
- bin/scripts/docker-entrypoint.sh
- src/glyphs/**
- .dockerignore
- Dockerfile
- font-patcher
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

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM alpine:3.11
LABEL org.opencontainers.image.title="Nerd Fonts Patcher" \
org.opencontainers.image.description="Patches developer targeted fonts with a high number of glyphs (icons)." \
org.opencontainers.image.url="https://www.nerdfonts.com/" \
org.opencontainers.image.source="https://github.com/ryanoasis/nerd-fonts" \
org.opencontainers.image.licenses="MIT"
RUN apk add fontforge --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing && \
apk add --no-cache py2-pip && \
pip install configparser
# sys.stdout.write encoding (py)
ENV PYTHONIOENCODING=utf-8
VOLUME /in /out
COPY . /nerd
ENTRYPOINT [ "/bin/sh", "/nerd/bin/scripts/docker-entrypoint.sh" ]

View File

@ -0,0 +1,19 @@
#!/bin/sh
skip=false
args=""
# Discard --out option
for i; do
[ "${i}" != "${i% *}" ] && i="\"$i\""
if [ "$i" = "--out" ] || [ "$i" = "-o" ]; then
skip=true
else
if [ "$skip" = false ] || [ "$i" == "-*" ]; then
args="$args $i"
fi
skip=false
fi
done
for f in /in/*.otf /in/*.ttf /in/*.woff /in/*.eot; do [ -f $f ] && fontforge -script /nerd/font-patcher -out /out $args $f; done

View File

@ -311,6 +311,7 @@ Patching the font of your own choosing for use with the [VimDevIcons ➶][vim-de
* requires: Python 2 (or Python 3), `python-fontforge` package (version `20141231` or later, see
the [install instructions](http://designwithfontforge.com/en-US/Installing_Fontforge.html))
* alternative install method on OSX: `brew install fontforge`
* alternative method using Docker: [Docker Hub](https://hub.docker.com/r/nerdfonts/patcher)
* Usage:
```
@ -323,6 +324,11 @@ Patching the font of your own choosing for use with the [VimDevIcons ➶][vim-de
./fontforge -script font-patcher PATH_TO_FONT
```
* Patching fonts with Docker:
```
docker run -v /path/to/fonts:/in -v /path/for/output:/out nerdfonts/patcher [OPTIONS]
```
```
usage: font-patcher [-h] [-v] [-s] [-l] [-q] [-w] [-c] [--fontawesome]
@ -397,7 +403,8 @@ optional arguments:
./font-patcher Inconsolata.otf --fontawesome
./font-patcher Inconsolata.otf --fontawesome --octicons --pomicons
./font-patcher Inconsolata.otf
docker run --rm -v ~/myfont/patchme:/in -v ~/myfont/patched:/out nerdfonts/patcher
docker run --rm -v ~/Desktop/myfont/patchme:/in -v ~/Desktop/myfont/patched:/out nerdfonts/patcher --fontawesome
<a name="gotta-patch-em-all"></a>
## Gotta Patch 'em All Font Patcher!