forked from mdelapenya/docker-tomcat-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (37 loc) · 1.54 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
FROM openjdk:7-jdk
MAINTAINER Manuel de la Peña <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
ENV TOMCAT_MAJOR_VERSION=7
ENV TOMCAT_VERSION=7.0.77
ENV TOMCAT_HOME=/opt/apache-tomcat-$TOMCAT_VERSION
# Install mysql-server and tomcat 7
RUN apt-get update && apt-get install -y lsb-release && \
wget https://dev.mysql.com/get/mysql-apt-config_0.8.4-1_all.deb && \
dpkg -i mysql-apt-config_0.8.4-1_all.deb && rm -f mysql-apt-config_0.8.4-1_all.deb && \
mkdir -p $TOMCAT_HOME && cd /opt && \
wget https://archive.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR_VERSION/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz && \
tar -xvf apache-tomcat-$TOMCAT_VERSION.tar.gz && rm -f apache-tomcat-$TOMCAT_VERSION.tar.gz
# Install packages
RUN apt-get update && \
apt-get -y install mysql-server pwgen supervisor && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add image configuration and scripts
ADD start-tomcat.sh /start-tomcat.sh
ADD start-mysqld.sh /start-mysqld.sh
ADD run.sh /run.sh
RUN chmod 755 /*.sh
ADD my.cnf /etc/mysql/conf.d/my.cnf
ADD supervisord-tomcat.conf /etc/supervisor/conf.d/supervisord-tomcat.conf
ADD supervisord-mysqld.conf /etc/supervisor/conf.d/supervisord-mysqld.conf
# Remove pre-installed database
RUN rm -rf /var/lib/mysql/*
# Add MySQL utils
ADD create_mysql_admin_user.sh /create_mysql_admin_user.sh
ADD mysql-setup.sh /mysql-setup.sh
RUN chmod 755 /*.sh
WORKDIR $TOMCAT_HOME
# Add volumes for MySQL
VOLUME ["/etc/mysql", "/var/lib/mysql"]
EXPOSE 8080 3306
ENTRYPOINT ["/run.sh"]