forked from universityofadelaide/s2i-shepherd-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
118 lines (98 loc) · 2.96 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
FROM ubuntu:18.04
MAINTAINER "Simon Lindsay <[email protected]>"
LABEL io.k8s.description="Platform for serving Wordpress PHP apps in Shepherd" \
io.k8s.display-name="Shepherd Wordpress" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder,shepherd,wordpress,php,apache" \
io.openshift.s2i.scripts-url="image:///usr/local/s2i"
ENV DEBIAN_FRONTEND noninteractive
# Configured timezone.
ENV TZ=Australia/Adelaide
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Ensure UTF-8.
ENV LANG en_AU.UTF-8
ENV LANGUAGE en_AU:en
ENV LC_ALL en_AU.UTF-8
# Upgrade all currently installed packages and install web server packages.
RUN apt-get update \
&& apt-get -y install locales \
&& sed -i -e 's/# en_AU.UTF-8 UTF-8/en_AU.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen en_AU.UTF-8 \
&& apt-get -y dist-upgrade \
&& apt-get -y install \
apache2 \
bind9-host \
git \
gnupg2 \
iputils-ping \
iproute2 \
libapache2-mod-php7.2 \
libedit-dev \
mysql-client \
php-apcu \
php-bcmath \
php-common \
php-curl \
php-gd \
php-ldap \
php-mbstring \
php-memcached \
php-mysql \
php-opcache \
php-redis \
php-soap \
php-sqlite3 \
php-xml \
php-zip \
restic \
rsync \
sqlite3 \
ssmtp \
telnet \
unzip \
wget \
&& apt-get -y autoremove && apt-get -y autoclean && apt-get clean && rm -rf /var/lib/apt/lists /tmp/* /var/tmp/*
# Install Composer.
RUN wget -q https://getcomposer.org/installer -O - | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer global require hirak/prestissimo
# Make bash the default shell.
RUN ln -sf /bin/bash /bin/sh
# Apache config.
COPY ./files/apache2.conf /etc/apache2/apache2.conf
COPY ./files/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf
# PHP config.
COPY ./files/php_custom.ini /etc/php/7.2/mods-available/php_custom.ini
# Configure apache modules, php modules, logging.
RUN a2enmod rewrite \
&& a2dismod vhost_alias \
&& a2disconf other-vhosts-access-log \
&& a2dissite 000-default \
&& phpenmod -v ALL -s ALL php_custom
# Add /code /shared directories and ensure ownership by User 33 (www-data) and Group 0 (root).
RUN mkdir -p /code /shared
# Add s2i scripts.
COPY ./s2i/bin /usr/local/s2i
RUN chmod +x /usr/local/s2i/*
ENV PATH "$PATH:/usr/local/s2i:/code/bin"
# Web port.
EXPOSE 8080
# Set working directory.
WORKDIR /code
# Change all ownership to User 33 (www-data) and Group 0 (root).
RUN chown -R 33:0 /var/www \
&& chown -R 33:0 /run/lock \
&& chown -R 33:0 /var/run/apache2 \
&& chown -R 33:0 /var/log/apache2 \
&& chown -R 33:0 /code \
&& chown -R 33:0 /shared
RUN chmod -R g+rwX /var/www \
&& chmod -R g+rwX /run/lock \
&& chmod -R g+rwX /var/run/apache2 \
&& chmod -R g+rwX /var/log/apache2 \
&& chmod -R g+rwX /code \
&& chmod -R g+rwX /shared
# Change the homedir of www-data to be /code.
RUN usermod -d /code www-data
USER 33:0
# Start the web server.
CMD ["/usr/local/s2i/run"]