This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathDockerfile
85 lines (72 loc) · 2.94 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
# LibreSignage Dockerfile. This dockerfile builds a LibreSignage
# image and configures any required software in the image. The
# following build arguments can be used when invoking 'docker build':
#
# vidthumbs = (y/n) - Enable video thumbnail generation w/ ffmpeg.
# imgthumbs = (y/n) - Enable image thumbnail generation w/ PHP gd.
# debug = (y/n) - Enable debugging. This option selects whether
# to use PHP's prod or dev config. The development
# config is used when $debug == "y" and the prod
# config is used otherwise.
# version = (string) - The version number used in the image labels.
# logdir = (path) - The log directory path for LibreSignage.
# approot = (path) - The approot for LibreSignage.
#
FROM php:7.2-apache-stretch
ARG imgthumbs="n"
ARG vidthumbs="n"
ARG debug="n"
ARG version="v0.0.0"
ARG logdir=""
ARG approot=""
LABEL description="An open source digital signage solution."
LABEL version="$version"
LABEL maintainer="Eero Talus"
LABEL copyright="Copyright 2018 Eero Talus"
LABEL license="BSD 3-clause license"
USER root
# Sanity check install paths and setup users.
RUN if [ -z "$approot" ]; then echo '[Error] Empty approot path.'; exit 1; fi \
&& if [ -z "$logdir" ]; then echo '[Error] Empty log dir path.'; exit 1; fi \
&& useradd -r docker && addgroup docker www-data
# Copy LibreSignage files.
COPY --chown=docker:docker "dist/" "$approot"
COPY --chown=docker:docker "server/libresignage/conf/*" "$approot/config/conf/."
# Set default file permissions and create the log directory.
RUN chown -R docker:www-data "$approot/data" \
&& find "$approot" -type d -print0 | xargs -0 chmod 755 \
&& find "$approot/data" -type d -print0 | xargs -0 chmod 775 \
&& find "$approot" -type f -print0 | xargs -0 chmod 644 \
&& find "$approot/data" -type f -print0 | xargs -0 chmod 664 \
&& mkdir -p "$logdir" \
&& chown root:www-data "$logdir" \
&& chmod 775 "$logdir"
# Install dependencies for image thumbnail generation.
RUN if [ "$imgthumbs" = "y" ]; then \
apt-get update \
&& apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include \
--with-jpeg-dir=/usr/include \
&& docker-php-ext-install -j$(nproc) gd; \
fi
# Install dependencies for video thumbnail generation.
RUN if [ "$vidthumbs" = "y" ]; then \
apt-get update \
&& apt-get install -y ffmpeg; \
fi
# Configure PHP.
RUN PHPDIR="/usr/local/etc/php"; \
if [ "$debug" = "y" ]; then \
cp "$PHPDIR/php.ini-development" "$PHPDIR/conf.d/01-dev.ini"; \
else \
cp "$PHPDIR/php.ini-production" "$PHPDIR/conf.d/01-prod.ini"; \
fi
COPY server/php/ls-docker.ini /usr/local/etc/php/conf.d/02-ls-docker.ini
# Configure apache2.
COPY server/apache2/ls-docker.conf /etc/apache2/conf-available/ls-docker.conf
RUN a2dissite --quiet 000-default \
&& a2enconf --quiet ls-docker.conf \
&& a2enmod --quiet rewrite
EXPOSE 80