Skip to content

Commit

Permalink
Add support for automated DockerHub builds (#1181)
Browse files Browse the repository at this point in the history
This commit adds support for automated DockerHub builds in the
Dockerfile. This is composed of three changes 1) Dockerfile and related
files are moved into a dediated directory 2) a DockerHub-dedicated
hooks/build file is added and 3) Testing is disabled in the Dockerfile
to speed up the build.
  • Loading branch information
tkw1536 authored and brucemiller committed Sep 6, 2019
1 parent 2965787 commit d320f96
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
19 changes: 15 additions & 4 deletions release/Dockerfile → release/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@
# This Dockerfile expects the root directory of LaTeXML as a build context.
# To achieve this run the following command from the root directory:
#
# > docker build -t latexml -f release/Dockerfile .
# > docker build -t latexml -f release/docker/Dockerfile .

# This Dockerfile can include a full TeXLive installation.
# This is enabled by default however it can be disabled by providing a
# build argument like so:
#
# > docker build -t latexml --build-arg WITH_TEXLIVE=no -f release/Dockerfile .
# > docker build -t latexml --build-arg WITH_TEXLIVE=no -f release/docker/Dockerfile .
#
# Please be aware that including a full TeXLive installation can take a
# significant amount of time (depending on network connection) and will
# increase the image size to several Gigabytes.
#
# Futhermore to speed up the build process, it is also possible to
# tell docker not to run the tests during the build proess. To achieve
# this, pass --build-arg WITH_TESTS=no to the docker build command, e.g:
#
# > docker build -t latexml --build-arg WITH_TESTS=no -f release/docker/Dockerfile .


# We start from alpine linux 3.10
FROM alpine:3.10
Expand Down Expand Up @@ -53,6 +60,9 @@ RUN apk add --no-cache \
# Set to "no" to disable, "yes" to enable
ARG WITH_TEXLIVE="yes"

# Configure if we test during the build
ARG WITH_TESTS="yes"

# Install TeXLive if not disabled
RUN [ "$WITH_TEXLIVE" == "no" ] || (\
apk add --no-cache -U poppler harfbuzz-icu zziplib texlive-full \
Expand Down Expand Up @@ -82,6 +92,7 @@ ADD Makefile.PL /opt/latexml/Makefile.PL
#ADD manual.pdf /opt/latexml/manual.pdf
#ADD README.pod /opt/README.pod

# Installing via cpanm
# Installing via cpanm (with or without tests)
WORKDIR /opt/latexml
RUN cpanm .

RUN if [ "$WITH_TESTS" == "no" ] ; then cpanm --notest . ; else cpanm . ; fi
19 changes: 19 additions & 0 deletions release/docker/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# /=====================================================================\ #
# | LaTeXML DockerHub Hooks | #
# | This file is used by DockerHub during the automated build | #
# |=====================================================================| #
# | Thanks to Tom Wiesing <tom.wiesing@gmail.com> | #
# | Part of LaTeXML: | #
# | Public domain software, produced as part of work done by the | #
# | United States Government & not subject to copyright in the US. | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov> #_# | #
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
# \=========================================================ooo==U==ooo=/ #

# cd into the LaTeXML root directory
cd $(git rev-parse --show-toplevel)

# run the docker build without TeXLive to speed up builds
docker build --build-arg WITH_TEXLIVE=no --build-arg WITH_TESTS=no -f $DOCKERFILE_PATH -t $IMAGE_NAME .

0 comments on commit d320f96

Please sign in to comment.