11# Louis BAYLE, 2018-10-11
22
33# 2020-05-24: update to PHP v7.4
4- # 2021-11-11: do not include CodevTT: make it a volume for dev purpose
54# 2021-11-11: update to PHP v8.1
65
7- FROM centos:centos7
8- MAINTAINER Louis BAYLE <lbayle.work@gmail.com>
9-
106# ====================================================
117# Container with Apache, PHP8.1, Mantis, CodevTT
12- # ====================================================
8+ #
9+ # https://github.com/lbayle/codev
1310# https://hub.docker.com/r/lbayle/codevtt/
1411
1512# ====================================================
16- # build
17- # ====================================================
18- # docker build --rm -t codevtt:1.8.0 .
13+ # Build instructions:
14+ # docker build --rm -t codevtt:1.8.0 .
1915
2016# ====================================================
21- # run with docker-compose
22- # ====================================================
17+ # Run with docker-compose:
18+ #
19+ # wget https://raw.githubusercontent.com/lbayle/codev/master/doc/docker/docker-compose.yml
20+ # wget https://raw.githubusercontent.com/lbayle/codev/master/doc/docker/mantis_codevtt_freshInstall.sql
21+ # docker-compose up -d
22+ # docker exec -i docker-mariadb-1 mysql -uroot -pmy_password --force bugtracker < mantis_codevtt_freshInstall.sql
2323
24- # docker-compose.yml is here:
25- # https://github.com/lbayle/codev/blob/master/doc/docker/docker-compose.yml
24+ # ====================================================
2625
27- # run:
28- # git clone https://github.com/lbayle/codev.git /data/docker/codevtt/src
29- # docker-compose up -d
30- # docker exec -i docker-mariadb-1 mysql -uroot -pmy_password --force bugtracker < mantis_codevtt_freshInstall.sql
26+ FROM centos:centos7
27+ MAINTAINER Louis BAYLE <lbayle.work@gmail.com>
3128
32- # ====================================================
29+ # change the shell command for the RUN commands to be '/bin/bash -c' instead of '/bin/sh -c'
30+ #SHELL ["/bin/bash", "-c"]
3331
3432# Set proxy
3533#ENV http_proxy=http://111.222.333.444:8080
@@ -57,8 +55,8 @@ RUN yum -y install \
5755 vim-enhanced \
5856 wget \
5957 zip unzip \
60- sudo && \
61- yum clean all
58+ sudo \
59+ && yum clean all
6260
6361# ------------------
6462# install MySQL command-line client (for debug purpose)
@@ -100,6 +98,33 @@ RUN yum -y --enablerepo=remi-php81 install \
10098 php-intl && \
10199 yum clean all
102100
101+ RUN sed -i '/^#ServerName/a ServerName codevtt:80' /etc/httpd/conf/httpd.conf
102+
103+ # ------------------
104+ # Allow overriding specific directives in .htaccess
105+ #RUN sed -e '/<Directory "\/var\/www\/html">/,/<\/Directory>/s/AllowOverride None/AllowOverride All/' -i /etc/httpd/conf/httpd.conf
106+
107+ # Update httpd.conf in order to restrict access as defined by .htaccess file.
108+ # .htaccess files are not evaluated since a default apache install does not allow to override directives in /var/www
109+ RUN set -xe \
110+ && echo "#Mantis specific access policy" > /etc/httpd/conf.d/mantis.conf \
111+ && echo "#CodevTT specific access policy" > /etc/httpd/conf.d/codevtt.conf \
112+ && for f in $(find /var/www/html/mantis -name .htaccess) ; do \
113+ echo "<Directory $(dirname $f)>" >> /etc/httpd/conf.d/mantis.conf \
114+ && cat $f >> /etc/httpd/conf.d/mantis.conf \
115+ && echo -e "\n</Directory>\n" >> /etc/httpd/conf.d/mantis.conf \
116+ ; done \
117+ && for f in $(find /var/www/html/codevtt -name .htaccess) ; do \
118+ echo "<Directory $(dirname $f)>" >> /etc/httpd/conf.d/codevtt.conf \
119+ && cat $f >> /etc/httpd/conf.d/codevtt.conf \
120+ && echo -e "\n</Directory>\n" >> /etc/httpd/conf.d/codevtt.conf \
121+ ; done
122+
123+
124+ # FIX Invalid command 'CGIPassAuth', perhaps misspelled or defined by a module not included in the server configuration
125+ # => centos:7 is getting too old...
126+ RUN sed -i '/^CGIPassAuth/ s/./#&/' /etc/httpd/conf.d/mantis.conf
127+
103128# ------------------
104129
105130# set system timezone
@@ -153,31 +178,8 @@ RUN set -xe \
153178 && chown -R apache:apache /var/www/html/codevtt
154179
155180# ------------------
156- # Update httpd.conf in order to restrict access as defined by .htaccess file.
157- # .htaccess files are not evaluated since a default apache install does not allow to override directives in /var/www
158- RUN set -xe \
159- && echo "#Mantis specific access policy" > /etc/httpd/conf.d/mantis.conf \
160- && echo "#CodevTT specific access policy" > /etc/httpd/conf.d/codevtt.conf \
161- && for f in $(find /var/www/html/mantis -name .htaccess) ; do \
162- echo "<Directory $(dirname $f)>" >> /etc/httpd/conf.d/mantis.conf \
163- && cat $f >> /etc/httpd/conf.d/mantis.conf \
164- && echo -e "\n</Directory>\n" >> /etc/httpd/conf.d/mantis.conf \
165- ; done \
166- && for f in $(find /var/www/html/codevtt -name .htaccess) ; do \
167- echo "<Directory $(dirname $f)>" >> /etc/httpd/conf.d/codevtt.conf \
168- && cat $f >> /etc/httpd/conf.d/codevtt.conf \
169- && echo -e "\n</Directory>\n" >> /etc/httpd/conf.d/codevtt.conf \
170- ; done
171-
172- # FIX Invalid command 'CGIPassAuth', perhaps misspelled or defined by a module not included in the server configuration
173- # => centos:7 is getting too old...
174- RUN sed -i '/^CGIPassAuth/ s/./#&/' /etc/httpd/conf.d/mantis.conf
175-
176- RUN sed -i '/^#ServerName/a ServerName codevtt:80' /etc/httpd/conf/httpd.conf
181+ # Adding default config files
177182
178- # ------------------
179- # Adding config files (bugtracker)
180- #ADD httpd_config/ssl.conf /etc/httpd/conf.d/ssl.conf
181183ADD mantis_config/config_inc.php /var/www/html/mantis/config/
182184ADD mantis_config/custom_constants_inc.php /var/www/html/mantis/config/
183185ADD mantis_config/custom_relationships_inc.php /var/www/html/mantis/config/
@@ -186,23 +188,24 @@ ADD codevtt_config/config.ini /var/www/html/codevtt/config/
186188ADD codevtt_config/log4php.xml /var/www/html/codevtt/
187189ADD index.html /var/www/html/index.html
188190
189- # debug
190- RUN echo -e "<?php\nphpinfo();\n" > /var/www/html/phpinfo.php
191-
192- # Not realy needed, but you might want to retrieve the appropriate DB init for this image.
193- # docker exec -i docker-mariadb-1 mariadb -uroot -pmy_password --force bugtracker < mantis_codevtt_freshInstall.sql
194- ADD mantis_codevtt_freshInstall.sql /install/mantis_codevtt_freshInstall.sql
195- ADD docker-compose.yml /install/docker-compose.yml
196-
197191# the entrypoint.sh will create the initial configuration files if not found
198192# this may happen if you decide to override some directories with docker volumes
199193ADD entrypoint.sh /entrypoint.sh
200194ADD mantis_config /install/mantis_config
201195ADD codevtt_config /install/codevtt_config
202196ADD phpmyadmin_config /install/phpmyadmin_config
203197
198+ # Not realy needed, but you might want to retrieve the appropriate DB init for this image.
199+ # docker exec -i docker-mariadb-1 mariadb -uroot -pmy_password --force bugtracker < mantis_codevtt_freshInstall.sql
200+ ADD mantis_codevtt_freshInstall.sql /install/mantis_codevtt_freshInstall.sql
201+ ADD docker-compose.yml /install/docker-compose.yml
202+
203+ # debug
204+ #RUN echo -e "<?php\nphpinfo();\n" > /var/www/html/phpinfo.php
205+
204206# ------------------
205207
208+ # the entrypoint will check configuration & launch httpd
206209EXPOSE 80
207210ENTRYPOINT ["/entrypoint.sh"]
208211CMD ["-D", "FOREGROUND"]
0 commit comments