-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ubuntu.adapted
90 lines (75 loc) · 2.33 KB
/
Dockerfile.ubuntu.adapted
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
86
87
88
89
90
FROM ubuntu:20.04
LABEL maintainer="National Library of Finland"
LABEL version="0.1"
LABEL description="A Docker image for Skosmos with Apache httpd."
ARG DEBIAN_FRONTEND=noninteractive
# git is necessary for some composer packages e.g. davidstutz/bootstrap-multiselect
# gettext is necessary as php-gettext was available in 18.04, but not in 20.04
RUN apt-get update && apt-get install -y \
apache2 \
curl \
gettext \
git \
libapache2-mod-php7.4 \
locales \
php7.4 \
php7.4-curl \
php7.4-xsl \
php7.4-intl \
php7.4-mbstring \
php-apcu \
php-zip \
unzip \
&& rm -rf /var/lib/apt/lists/*
# https://stackoverflow.com/a/28406007
# fixes warnings like perl: warning: Setting locale failed.
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen \
ar_AE.utf8 \
da_DK.utf8 \
de_DE.utf8 \
en_GB.utf8 \
en_US.utf8 \
es_ES.utf8 \
fa_IR.utf8 \
fi_FI.utf8 \
fr_FR.utf8 \
it_IT.utf8 \
nb_NO.utf8 \
nl_NL.utf8 \
nn_NO.utf8 \
pl_PL.utf8 \
pt_PT.utf8 \
pt_BR.utf8 \
ru_RU.utf8 \
sv_SE.utf8 \
zh_CN.utf8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
# timezone
RUN sed -i 's/;date.timezone =/date.timezone = "UTC"/g' /etc/php/7.4/apache2/php.ini
COPY browse/dockerfiles/config/000-default.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
RUN a2enmod expires
# set ServerName & redirect error log to stderr for docker logs
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
sed -ri \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/1!g' \
"/etc/apache2/apache2.conf"
WORKDIR /var/www/html
RUN rm index.html
RUN mkdir browse
WORKDIR /var/www/html/browse
# composer and packages layer
RUN curl -sS https://getcomposer.org/installer | php
COPY browse/composer.json /var/www/html/browse
RUN php composer.phar install --no-dev --no-autoloader
# skosmos layer
COPY . /var/www/html
RUN php composer.phar install --no-dev
# Configure Skosmos
COPY browse/dockerfiles/config/config-docker.ttl /var/www/html/browse/config.ttl
HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl -f http://localhost || exit 1
EXPOSE 80
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]