/
Dockerfile.github
133 lines (118 loc) · 4.16 KB
/
Dockerfile.github
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
ARG ARCH=amd64
FROM ${ARCH}/ubuntu:22.04
ARG WT_VERSION=2.0.26
ARG QEMU_ARCH=x86_64
ARG BUILD_DATE=2021-01-01T08:00:00Z
ARG BUILD_VERSION=latest
ARG BUILD_REF=abcdef
# Set correct environment variables
ENV DEBIAN_FRONTEND="noninteractive" HOME="/root" LC_ALL="C.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"
ENV supervisor_conf /etc/supervisor/supervisord.conf
ENV security_conf /etc/apache2/conf-available/security.conf
ENV start_scripts_path /bin
LABEL org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.docker.dockerfile="Dockerfile.github" \
org.label-schema.name="Webtrees" \
org.label-schema.version=${BUILD_VERSION} \
org.label-schema.description="Docker Container for Webtrees." \
org.label-schema.url="https://webtrees.net" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-type="Git" \
org.label-schema.vcs-url="https://github.com/H2CK/webtrees.git" \
org.label-schema.arch=${ARCH}
#USER root
# QEMU - Quick Emulation
COPY tmp/qemu-$QEMU_ARCH-static /usr/bin/qemu-$QEMU_ARCH-static
# Update packages from baseimage
RUN apt-get update -qq
# Install and activate necessary software
# Remark: Apache module mod_wsgi is installed but not enabled (anymore)
RUN apt-get upgrade -qy && apt-get install -qy \
apt-utils \
cron \
supervisor \
apache2 \
apache2-utils \
libexpat1 \
ssl-cert \
vim-tiny \
php \
libapache2-mod-php \
php-mysql \
php-pgsql \
php-pdo-odbc \
php-curl \
php-gd \
php-intl \
php-pear \
php-imagick \
php-imap \
php-memcache \
php-pspell \
php-sqlite3 \
php-tidy \
php-xmlrpc \
php-xsl \
php-mbstring \
php-opcache \
php-apcu \
php-zip \
wget \
unzip \
sed \
mysql-client \
&& a2enmod ssl \
&& a2enmod headers \
&& a2enmod rewrite \
&& a2dissite 000-default \
&& mkdir /crt \
&& chmod 750 /crt \
&& openssl rand -out /root/.rnd -hex 256 \
&& openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout /crt/webtrees.key -out /crt/webtrees.crt -subj "/C=DE/ST=H/L=F/O=Webtrees/OU=www.webtrees.net/CN=webtrees" \
&& chmod 640 /crt/* \
&& wget --no-check-certificate https://github.com/fisharebest/webtrees/releases/download/${WT_VERSION}/webtrees-${WT_VERSION}.zip -O /tmp/webtrees.zip \
&& unzip -d /tmp/ -o /tmp/webtrees.zip \
&& rm -Rf /var/www/html \
&& mv /tmp/webtrees /var/www/html \
&& chown -R www-data:www-data /var/www/html \
&& chmod -R 770 /var/www/html \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /var/cache/* /var/tmp/* /tmp/* \
&& groupadd docker-data \
&& usermod -a -G docker-data,adm www-data
COPY supervisord.conf ${supervisor_conf}
COPY security.conf ${security_conf}
COPY 01_user_config.sh ${start_scripts_path}
COPY 02_auto_update.sh ${start_scripts_path}
COPY 03_set_a2port.sh ${start_scripts_path}
COPY 04_enable_REMOTE_USER.sh ${start_scripts_path}
COPY 05_switch_http_https.sh ${start_scripts_path}
COPY 07_set_prettyurls.sh ${start_scripts_path}
COPY 06_initialize_db.sh ${start_scripts_path}
COPY start.sh /start.sh
RUN chmod +x ${start_scripts_path}/01_user_config.sh \
&& chmod +x ${start_scripts_path}/02_auto_update.sh \
&& chmod +x ${start_scripts_path}/03_set_a2port.sh \
&& chmod +x ${start_scripts_path}/04_enable_REMOTE_USER.sh \
&& chmod +x ${start_scripts_path}/05_switch_http_https.sh \
&& chmod +x ${start_scripts_path}/07_set_prettyurls.sh \
&& chmod +x ${start_scripts_path}/06_initialize_db.sh \
&& chmod +x /start.sh
CMD ["./start.sh"]
ADD Auth.php /Auth.php
ADD config.ini.php /config.ini.php
ADD webtrees.sql /webtrees.sql
COPY .htaccess /var/www/html/.htaccess
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 770 /var/www/html
#Add Apache configuration
ADD php.ini /etc/php/8.1/apache2/
ADD webtrees.conf /etc/apache2/sites-available/
ADD webtrees_insecure.conf /etc/apache2/sites-available/
RUN chmod 644 /etc/apache2/sites-available/webtrees.conf \
&& chmod 644 /etc/apache2/sites-available/webtrees_insecure.conf \
&& a2dissite 000-default \
&& a2enmod ssl \
&& a2ensite webtrees
VOLUME /var/www/html/data
EXPOSE 443/tcp