Skip to content

Commit d320f96

Browse files
tkw1536brucemiller
authored andcommitted
Add support for automated DockerHub builds (brucemiller#1181)
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.
1 parent 2965787 commit d320f96

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

release/Dockerfile renamed to release/docker/Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,24 @@
1515
# This Dockerfile expects the root directory of LaTeXML as a build context.
1616
# To achieve this run the following command from the root directory:
1717
#
18-
# > docker build -t latexml -f release/Dockerfile .
18+
# > docker build -t latexml -f release/docker/Dockerfile .
1919

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

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

63+
# Configure if we test during the build
64+
ARG WITH_TESTS="yes"
65+
5666
# Install TeXLive if not disabled
5767
RUN [ "$WITH_TEXLIVE" == "no" ] || (\
5868
apk add --no-cache -U poppler harfbuzz-icu zziplib texlive-full \
@@ -82,6 +92,7 @@ ADD Makefile.PL /opt/latexml/Makefile.PL
8292
#ADD manual.pdf /opt/latexml/manual.pdf
8393
#ADD README.pod /opt/README.pod
8494

85-
# Installing via cpanm
95+
# Installing via cpanm (with or without tests)
8696
WORKDIR /opt/latexml
87-
RUN cpanm .
97+
98+
RUN if [ "$WITH_TESTS" == "no" ] ; then cpanm --notest . ; else cpanm . ; fi

release/docker/hooks/build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# /=====================================================================\ #
3+
# | LaTeXML DockerHub Hooks | #
4+
# | This file is used by DockerHub during the automated build | #
5+
# |=====================================================================| #
6+
# | Thanks to Tom Wiesing <[email protected]> | #
7+
# | Part of LaTeXML: | #
8+
# | Public domain software, produced as part of work done by the | #
9+
# | United States Government & not subject to copyright in the US. | #
10+
# |---------------------------------------------------------------------| #
11+
# | Bruce Miller <[email protected]> #_# | #
12+
# | http://dlmf.nist.gov/LaTeXML/ (o o) | #
13+
# \=========================================================ooo==U==ooo=/ #
14+
15+
# cd into the LaTeXML root directory
16+
cd $(git rev-parse --show-toplevel)
17+
18+
# run the docker build without TeXLive to speed up builds
19+
docker build --build-arg WITH_TEXLIVE=no --build-arg WITH_TESTS=no -f $DOCKERFILE_PATH -t $IMAGE_NAME .

0 commit comments

Comments
 (0)