summaryrefslogtreecommitdiffstats
path: root/docker/Dockerfile
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-11-06 23:21:30 +0100
committerDavid Lawrence <dkl@mozilla.com>2015-11-06 23:21:30 +0100
commitaf46939af5dbe914e07c9b1ec0af2560b38ffbc6 (patch)
treee3614dddfd2dff0a027c59345f70343f76619eb5 /docker/Dockerfile
parent60bde01b7ffc861a7bfba352af015b2b154e6f1e (diff)
downloadbugzilla-af46939af5dbe914e07c9b1ec0af2560b38ffbc6.tar.gz
bugzilla-af46939af5dbe914e07c9b1ec0af2560b38ffbc6.tar.xz
Bug 1222497 - Refactor the BMO docker image with new file and script structure while minimizing final image size
Diffstat (limited to 'docker/Dockerfile')
-rw-r--r--docker/Dockerfile68
1 files changed, 24 insertions, 44 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 7c4a96d71..ebba20a48 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -2,71 +2,51 @@ FROM centos:centos7
MAINTAINER David Lawrence <dkl@mozilla.com>
# Environment configuration
-ENV BUGS_DB_DRIVER mysql
-ENV BUGS_DB_NAME bugs
-ENV BUGS_DB_PASS bugs
-ENV BUGS_DB_HOST localhost
-
-ENV BUGZILLA_USER bugzilla
-ENV BUGZILLA_HOME /home/$BUGZILLA_USER
-ENV BUGZILLA_ROOT $BUGZILLA_HOME/devel/htdocs/bmo
-ENV BUGZILLA_URL http://localhost/bmo
-
+ENV USER bugzilla
+ENV HOME /home/bugzilla
+ENV BUGZILLA_ROOT $HOME/devel/htdocs/bmo
ENV GITHUB_BASE_GIT https://github.com/mozilla/webtools-bmo-bugzilla
ENV GITHUB_BASE_BRANCH master
-ENV GITHUB_QA_GIT https://github.com/mozilla/webtools-bmo-qa
-ENV ADMIN_EMAIL admin@mozilla.bugs
-ENV ADMIN_PASS password
+# Copy over all files and scripts
+COPY files /files
+COPY scripts /scripts
# Distribution package installation
-COPY rpm_list /rpm_list
-RUN yum -y -q install https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm \
- epel-release && yum clean all
-RUN yum -y -q install `cat /rpm_list` && yum clean all
+RUN yum -y -q install https://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm epel-release \
+ && yum -y -q install `cat /files/rpm_list` \
+ && yum clean all
# User configuration
-RUN useradd -m -G wheel -u 1000 -s /bin/bash $BUGZILLA_USER \
- && passwd -u -f $BUGZILLA_USER \
+RUN useradd -m -G wheel -u 1000 -s /bin/bash $USER \
+ && passwd -u -f $USER \
&& echo "bugzilla:bugzilla" | chpasswd
-# sshd
-RUN mkdir -p /var/run/sshd \
- && chmod -rx /var/run/sshd \
- && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' \
- && ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' \
- && ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' \
- && sed -ri 's/#UseDNS yes/UseDNS no/'g /etc/ssh/sshd_config
-
# Apache configuration
-COPY bugzilla.conf /etc/httpd/conf.d/bugzilla.conf
+RUN cp /files/bugzilla.conf /etc/httpd/conf.d/bugzilla.conf
# MySQL configuration
-COPY my.cnf /etc/my.cnf
-RUN chmod 644 /etc/my.cnf \
+RUN cp /files/my.cnf /etc/my.cnf \
+ && chmod 644 /etc/my.cnf \
&& chown root.root /etc/my.cnf \
&& rm -rf /etc/mysql \
&& rm -rf /var/lib/mysql/* \
- && /usr/bin/mysql_install_db --user=$BUGZILLA_USER --basedir=/usr --datadir=/var/lib/mysql
+ && /usr/bin/mysql_install_db --user=$USER --basedir=/usr --datadir=/var/lib/mysql
# Sudoer configuration
-COPY sudoers /etc/sudoers
-RUN chown root.root /etc/sudoers && chmod 440 /etc/sudoers
+RUN cp /files/sudoers /etc/sudoers \
+ && chown root.root /etc/sudoers \
+ && chmod 440 /etc/sudoers
# Clone the code repo
RUN su $BUGZILLA_USER -c "git clone $GITHUB_BASE_GIT -b $GITHUB_BASE_BRANCH $BUGZILLA_ROOT"
-# Copy setup and test scripts
-COPY *.sh buildbot_step generate_bmo_data.pl checksetup_answers.txt /
-RUN chmod 755 /*.sh /buildbot_step
-
# Bugzilla dependencies and setup
-RUN /install_deps.sh
-RUN /bugzilla_config.sh
-RUN /my_config.sh
-
-# Final permissions fix
-RUN chown -R $BUGZILLA_USER.$BUGZILLA_USER $BUGZILLA_HOME
+RUN chmod a+x /scripts/*
+RUN /scripts/install_deps.sh
+RUN /scripts/bugzilla_config.sh
+RUN /scripts/my_config.sh
+RUN chown -R $USER.$USER $HOME
# Networking
RUN echo "NETWORKING=yes" > /etc/sysconfig/network
@@ -78,6 +58,6 @@ EXPOSE 5900
ADD https://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar /selenium-server.jar
# Supervisor
-COPY supervisord.conf /etc/supervisord.conf
+RUN cp /files/supervisord.conf /etc/supervisord.conf
RUN chmod 700 /etc/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]