-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.mine
88 lines (68 loc) · 2.7 KB
/
Dockerfile.mine
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
FROM centos:6
MAINTAINER itspoma <[email protected]>
ENV MYSQL_USER root
ENV MYSQL_PASSWORD toortoor
ENV BUGZILLA_VERSION 5.0
ENV BUGZILLA_DB bugzilladb
ENV BUGZILLA_USER bugzillauser
ENV BUGZILLA_PASSWORD bugspassword
ENV ADMIN_EMAIL aaa
ENV ADMIN_PASSWORD password
# yum packagies
RUN yum clean all \
&& yum install -y which wget curl gcc-c++ tar git bzip2 \
&& yum install -y mc \
&& yum install -y epel-release
# apache2
RUN yum install -y httpd
# mysql install
RUN yum install -y mysql mysql-server
# perl modules
RUN yum -y install 'perl(parent)' \
&& yum -y install perl-libwww-perl \
&& yum -y install perl-core
# configure the httpd
RUN sed 's/#ServerName.*/ServerName app/' -i /etc/httpd/conf/httpd.conf \
&& sed 's/#EnableSendfile.*/EnableSendfile off/' -i /etc/httpd/conf/httpd.conf
# put vhost config for httpd
ADD ./environment/httpd/bugzilla.conf /etc/httpd/conf.d/bugzilla.conf
# mysql configure
RUN sed 's/^user.*/user=root/' -i /etc/my.cnf \
&& sed 's/^datadir.*/datadir=\/shared\/environment\/mysql\/data/' -i /etc/my.cnf \
&& sed 's/^log-error.*/log-error=\/shared\/logs\/mysqld.log/' -i /etc/my.cnf
ADD ./environment /shared/environment
ADD ./logs /shared/logs
RUN true \
&& rm -rf /shared/environment/mysql/data \
&& mysql_install_db \
&& service mysqld restart \
&& mysqladmin -u ${MYSQL_USER} password "${MYSQL_PASSWORD}" \
&& mysql -u ${MYSQL_USER} -p${MYSQL_PASSWORD} -e "SHOW DATABASES;"
# bugzilla db
RUN service mysqld start \
&& mysql -u ${MYSQL_USER} -p${MYSQL_PASSWORD} -e "CREATE DATABASE ${BUGZILLA_DB} CHARACTER SET = 'utf8';" \
&& mysql -u ${MYSQL_USER} -p${MYSQL_PASSWORD} -e "GRANT ALL PRIVILEGES ON ${BUGZILLA_DB}.* TO ${BUGZILLA_USER}@localhost IDENTIFIED BY '${BUGZILLA_PASSWORD}'; FLUSH PRIVILEGES;"
# bugzilla
RUN wget -P /tmp/ https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-${BUGZILLA_VERSION}.tar.gz \
&& tar -xzvf /tmp/bugzilla-*.tar.gz -C /tmp/ \
&& rm -rf /tmp/bugzilla-*.tar.gz \
&& rm -rf /shared/site/bugzilla \
&& mv /tmp/bugzilla-* /shared/site/bugzilla
ADD ./environment/bugzilla/localconfig /shared/site/bugzilla/localconfig
# bugzilla setup
RUN service mysqld restart \
&& cd /shared/site/bugzilla/ && perl install-module.pl --all && cd /shared \
&& perl /shared/site/bugzilla/checksetup.pl /shared/environment/bugzilla/checksetup_answers.txt
RUN yes | cp -rf /shared/environment/bugzilla/localconfig /shared/site/bugzilla/localconfig \
&& perl /shared/site/bugzilla/checksetup.pl /shared/environment/bugzilla/checksetup_answers.txt
WORKDIR /shared
EXPOSE 80
CMD ["/bin/bash", "/shared/environment/init.sh"]
# # to init mysql
# /usr/bin/mysql_install_db
#
# # restart services
# /sbin/service httpd restart
# /sbin/service mysqld restart
#
# /bin/bash