-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
112 lines (99 loc) · 3.99 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
ARG VERSION
ARG BASE=ubuntu:noble
ARG GUILE_VERSION=2.2
########################################################################################
# Build LilyPond on the latest Ubuntu. Unfortunately compiling does not work on alpine.
########################################################################################
FROM $BASE AS build
ARG VERSION
ARG GUILE_VERSION
ARG DEBIAN_FRONTEND=noninteractive
ENV PATH="/opt/bin:$PATH" PKG_CONFIG_PATH="/opt/lib/pkgconfig:$PKG_CONFIG_PATH"
# Install Build Dependencies
RUN apt-get -qq --yes update && \
# LilyPond Build Dependencies
# See https://lilypond.org/doc/v2.23/Documentation/contributor/requirements-for-compiling-lilypond#other
apt-get -qq --yes install \
build-essential \
guile-$GUILE_VERSION-dev \
python3-dev \
autoconf \
pkg-config \
bison \
flex \
gettext \
make \
texlive-base \
texlive-metapost \
perl \
texinfo \
fontforge \
t1utils \
texlive-lang-cyrillic \
libpango1.0-dev \
fonts-texgyre \
# Use curl to download additional resources
curl
# Build LilyPond
WORKDIR "/build/lilypond-$VERSION"
RUN curl -fsSL https://lilypond.org/download/sources/v${VERSION%.*}/lilypond-$VERSION.tar.gz \
| tar --extract --gzip --strip-components=1 \
&& ./autogen.sh --prefix=/opt --disable-documentation \
&& make -s -j$(($(nproc)+1)) \
&& make -s install
########################################################################################
# Install Microsoft fonts in a new ubuntu environment
########################################################################################
FROM $BASE AS build-fonts
ARG DEBIAN_FRONTEND=noninteractive
# Install Additional Fonts
WORKDIR /build/msfonts
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections && \
apt-get -qq --yes update && \
apt-get -qq --yes install \
wget \
fonts-dejavu-extra \
ttf-mscorefonts-installer && \
rm -rf /var/lib/apt/lists/* && \
# This fix is taken from here:
# https://askubuntu.com/questions/1163560/change-mirror-for-ttf-mscorefonts-installer
awk '/Url/ {sub("downloads[.]sourceforge[.]net/corefonts","downloads.sourceforge.net/project/corefonts/the%20fonts/final",$2); system("wget "$2)}' /usr/share/package-data-downloads/ttf-mscorefonts-installer && \
/usr/lib/msttcorefonts/update-ms-fonts $(pwd)/*.exe
########################################################################################
# Install runtime dependencies and copy the build artifacts from the previous stage.
########################################################################################
FROM $BASE
ARG VERSION
ARG GUILE_VERSION
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq --yes update && \
apt-get -qq --yes install \
guile-$GUILE_VERSION \
libcairo2 \
libfontconfig1 \
libfreetype6 \
ghostscript \
libpangoft2-1.0 \
libltdl7 \
python3-minimal \
# Some tools for convenience
make \
jq \
unzip \
curl \
ca-certificates \
fonts-texgyre \
# Update Fonts
&& apt-get -qq --yes purge --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /opt /opt
# Copy fonts into the final image.
COPY --from=build-fonts /usr/share/fonts /usr/share/fonts
COPY ./fonts/*/supplementary-fonts/*.otf ./fonts/*/supplementary-files/*/*.otf /usr/share/fonts/opentype/
COPY ./fonts/*/supplementary-fonts/*.ttf ./fonts/*/supplementary-files/*/*.ttf /usr/share/fonts/truetype/
COPY ./fonts/*/stylesheet/* "/opt/share/lilypond/$VERSION/ly/"
COPY ./fonts/*/otf ./fonts/*/woff "/opt/share/lilypond/$VERSION/fonts/otf/"
COPY ./fonts/*/svg/* "/opt/share/lilypond/$VERSION/fonts/svg/"
ENV PATH="/opt/bin:$PATH" LD_LIBRARY_PATH="/opt/lib:$LD_LIBRARY_PATH"
WORKDIR /work
ENTRYPOINT ["lilypond"]