-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): Add dockerfile and setup to build an image
- Loading branch information
Showing
5 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ rules: | |
- 1 | ||
- 'always' | ||
- - core | ||
- docker | ||
- utilities | ||
- settings | ||
- typesetter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then | ||
set -- sile "$@" | ||
fi | ||
|
||
exec "$@" |