diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..d0693ab88 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +** +!src/glyphs/*.* +!font-patcher +!bin/scripts/docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..380cb76a2 --- /dev/null +++ b/Dockerfile @@ -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" ] diff --git a/bin/scripts/docker-entrypoint.sh b/bin/scripts/docker-entrypoint.sh new file mode 100644 index 000000000..beefebe53 --- /dev/null +++ b/bin/scripts/docker-entrypoint.sh @@ -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