Skip to content
Permalink
Browse files

feat(docker): Add dockerfile and setup to build an image

  • Loading branch information
alerque committed Jan 17, 2020
1 parent 4f24d4a commit 4424d4469905edf43815464d74229184b4710aad
Showing with 52 additions and 0 deletions.
  1. +1 −0 .commitlintrc.yml
  2. +16 −0 Dockerfile
  3. +4 −0 Makefile.am
  4. +23 −0 build-aux/build-for-docker.sh
  5. +8 −0 build-aux/docker-entrypoint.sh
@@ -22,6 +22,7 @@ rules:
- 1
- 'always'
- - core
- docker
- utilities
- settings
- typesetter
@@ -0,0 +1,16 @@
FROM archlinux

ARG sile_tag=master

LABEL maintainer='Caleb Maclennan <caleb@alerque.com>'
LABEL version="$sile_tag"

RUN pacman --needed --noconfirm -Syuq && yes | pacman -Sccq

COPY build-aux/build-for-docker.sh /usr/local/bin/
RUN build-for-docker.sh

COPY build-aux/docker-entrypoint.sh /usr/local/bin

WORKDIR /data
ENTRYPOINT ["docker-entrypoint.sh"]
@@ -305,6 +305,10 @@ endif

CLEANFILES = $(bin_SCRIPTS) $(dist_man_MANS) $(DEPFILES) $(ACTUALS) $(TESTPDFS)

.PHONY: docker
docker:
docker build --tag siletypesetter/sile:HEAD ./

gource.webm:
mkdir -p /tmp/gravatars
convert examples/images/sile-logo.jpg -negate -resize 50% /tmp/sile-logo.jpg
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e +o pipefail

# Setup AUR helper and other build time dependencies in a way they will be removed from the final image
pacman --needed --noconfirm --asdeps -S git base-devel go poppler
useradd -m docker
echo 'docker:' | chpasswd -e
mkdir -p /etc/sudoers.d
echo 'docker ALL = NOPASSWD: ALL' > /etc/sudoers.d/99-docker
su docker -c 'cd; git clone https://aur.archlinux.org/yay.git; cd yay; makepkg -i --noconfirm --asdeps'

# Install SILE's own prerequisites in a way they will stay in the final image
deps="fontconfig harfbuzza icu lua ttf-gentium-plus"
deps+=" lua-{luaepnf,lpeg,cassowary,linenoise,zlib,cliargs,filesystem,repl,sec,socket,penlight,stdlib,vstruct}"
su docker -c "yay --needed --noconfirm --asexplicit -S $deps"

# Build and install SILE itself

# Tear down build time depencies before layer gets imaged
su docker -c 'yay --noconfirm -Yccq'
yes | pacman -Sccq
userdel -r -f docker
rm -rf /etc/sudoers.d
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- sile "$@"
fi

exec "$@"

0 comments on commit 4424d44

Please sign in to comment.
You can’t perform that action at this time.