Skip to content

Instantly share code, notes, and snippets.

@MasterOdin
Created June 25, 2018 10:52
Show Gist options
  • Save MasterOdin/29f65c5939b282de0cc846dd2b304c21 to your computer and use it in GitHub Desktop.
Save MasterOdin/29f65c5939b282de0cc846dd2b304c21 to your computer and use it in GitHub Desktop.
asciidoc-alpine
# You can specify a specific python version of slim (based on Debian stretch, see https://hub.docker.com/_/python/)
# by doing --build-arg PYTHON_VERSION=<version> on the build command, and it defaults to Python 3.6
ARG PYTHON_VERSION=3.6
FROM python:${PYTHON_VERSION}-alpine
ENV GLIBC_VERSION 2.27-r0
ENV LILYPOND_VERSION 2.18.2-1
ENV DVISVGM_VERSION 2.4
ENV SOURCE_HIGHLIGHT_VERSION 3.1.8
RUN apk --no-cache add \
autoconf \
boost-dev \
curl \
docbook-xsl \
freetype-dev \
g++ \
gcc \
gd-dev \
graphviz \
highlight \
imagemagick \
libpng-dev \
libffi-dev \
libxml2-utils \
make \
openssl-dev \
potrace-dev \
py3-pygments \
wget \
unzip \
&& \
apk --no-cache --repository http://nl.alpinelinux.org/alpine/edge/main add icu-libs && \
apk --no-cache --repository http://nl.alpinelinux.org/alpine/edge/community add \
texinfo \
texlive \
texlive-dev
RUN cd /tmp && \
wget https://github.com/mgieseki/dvisvgm/releases/download/${DVISVGM_VERISON}/dvisvgm-${DVISVGM_VERISON}.tar.gz && \
tar -xvf dvisvgm-${DVISVGM_VERISON}.tar.gz && \
cd dvisvgm-${DVISVGM_VERISON} && \
./configure && \
make && \
make install && \
cd /tmp && \
rm -rf dvisvgm*
RUN cd /tmp && \
wget wget ftp://ftp.gnu.org/gnu/src-highlite/source-highlight-${SOURCE_HIGHLIGHT_VERSION}.tar.gz && \
tar -xvf source-highlight-${SOURCE_HIGHLIGHT_VERSION}.tar.gz && \
cd source-highlight-${SOURCE_HIGHLIGHT_VERSION} && \
./configure && \
make && \
make install && \
cd /tmp && \
rm -rf source-highlight*
# install glibc for Lilypond as libc6-compat doesn't quite work unfortunately. The better solution is to figure out
# how to become a maintainer of a package for Alpine and maintain Lilypond there so we can use proper depends and
# things and not use the fully bundled version of it
RUN cd /tmp && \
curl -Lo /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
curl -Lo glibc.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk" && \
curl -Lo glibc-bin.apk "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk" && \
apk add glibc-bin.apk glibc.apk && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
apk del curl && \
rm -rf glibc.apk glibc-bin.apk /var/cache/apk/*
# Lilypond
RUN cd /tmp && \
wget http://download.linuxaudio.org/lilypond/binaries/linux-64/lilypond-${LILYPOND_VERSION}.linux-64.sh && \
echo -e "\n" | sh lilypond-${LILYPOND_VERSION}.linux-64.sh && \
rm -rf lilypond-${LILYPOND_VERSION}
# dvipng
RUN cd /tmp && \
wget http://mirrors.ctan.org/dviware/dvipng.zip && \
unzip dvipng.zip && \
cd dvipng && \
./configure && \
make && \
make install && \
cd /tmp && \
rm -rf dvipng*
COPY . "/srv/asciidoc"
WORKDIR "/srv/asciidoc"
# override the base image's default of opening python interpreter when doing docker run
CMD ["/bin/sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment