From f967f620360ea75b9da846263dc0a22e6d70bd72 Mon Sep 17 00:00:00 2001 From: Tommy Wang Date: Wed, 17 Jun 2020 15:06:57 -0500 Subject: [PATCH] Dockerize build --- Dockerfile | 13 +++++++++++++ Makefile | 7 +++++++ script/build | 4 ++-- script/build_ttf | 2 +- script/build_variable | 2 +- script/build_woff | 4 ++-- script/build_woff2 | 4 ++-- 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..305b98a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3 + +WORKDIR /opt + +RUN pip install -U Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 +RUN pip install pycairo +RUN pip install git+https://github.com/googlefonts/gftools +RUN pip install fontmake +RUN apt-get update && \ + apt-get install -y ttfautohint && \ + apt-get install -y woff2 && \ + apt-get install -y sfnt2woff-zopfli +RUN pip install fontbakery diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..680d701 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +all: dep build + +dep: + docker build -t fira:latest . + +build: + docker run --rm -v ${PWD}:/opt fira:latest ./script/build diff --git a/script/build b/script/build index 0cb43e4..b9ccf35 100755 --- a/script/build +++ b/script/build @@ -1,6 +1,6 @@ #!/bin/bash -e -source venv/bin/activate +[ -d venv ] && source venv/bin/activate # ============================================================================ # VARIABLE FONT ============================================================== @@ -87,4 +87,4 @@ mkdir -p distr/woff woffs=$(ls distr/*/*.woff) for woff in $woffs; do mv $woff distr/woff/$(basename $woff) -done \ No newline at end of file +done diff --git a/script/build_ttf b/script/build_ttf index bf5f7cf..805949b 100755 --- a/script/build_ttf +++ b/script/build_ttf @@ -1,6 +1,6 @@ #!/bin/bash -euo pipefail -source venv/bin/activate +[ -d venv ] && source venv/bin/activate args=( "$@" ) default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" ) diff --git a/script/build_variable b/script/build_variable index 5322025..30d33bc 100755 --- a/script/build_variable +++ b/script/build_variable @@ -2,7 +2,7 @@ cd "`dirname $0`/.." -source venv/bin/activate +[ -d venv ] && source venv/bin/activate DIR=distr/variable_ttf FILE=FiraCode-VF.ttf diff --git a/script/build_woff b/script/build_woff index 34c7b19..1a2af18 100755 --- a/script/build_woff +++ b/script/build_woff @@ -2,7 +2,7 @@ # requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools) cd "`dirname $0`/.." -source venv/bin/activate +[ -d venv ] && source venv/bin/activate rm -rf distr/*/*.woff @@ -14,4 +14,4 @@ done mkdir -p distr/woff mv distr/*/*.woff distr/woff -rm distr/woff/FiraCode-Retina.woff \ No newline at end of file +rm distr/woff/FiraCode-Retina.woff diff --git a/script/build_woff2 b/script/build_woff2 index ad13cfb..0cb94a3 100755 --- a/script/build_woff2 +++ b/script/build_woff2 @@ -2,7 +2,7 @@ # requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools) cd "`dirname $0`/.." -source venv/bin/activate +[ -d venv ] && source venv/bin/activate rm -rf distr/*/*.woff2 @@ -13,4 +13,4 @@ done mkdir -p distr/woff2 mv distr/*/*.woff2 distr/woff2 -rm distr/woff2/FiraCode-Retina.woff2 \ No newline at end of file +rm distr/woff2/FiraCode-Retina.woff2