mirror of
https://github.com/bitnami/containers.git
synced 2026-03-21 15:29:05 +08:00
Cleaner dockerfile for mariadb
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
FROM ubuntu-debootstrap:14.04
|
||||
MAINTAINER Bitnami
|
||||
|
||||
RUN apt-get update -q && DEBIAN_FRONTEND=noninteractive apt-get install -qy wget && \
|
||||
wget -q --no-check-certificate https://downloads.bitnami.com/files/download/mariadb/bitnami-mariadb-5.5.42-0-linux-x64-installer.run -O /tmp/installer.run && \
|
||||
chmod +x /tmp/installer.run && \
|
||||
/tmp/installer.run --mode unattended --base_password bitnami --mysql_password bitnami --mysql_allow_all_remote_connections 1 --prefix /opt/bitnami --disable-components common && \
|
||||
/opt/bitnami/mysql/scripts/ctl.sh stop mysql > /dev/null && \
|
||||
echo "bin/mysql -S /opt/bitnami/mysql/tmp/mysql.sock -u root -p\$2 -e \"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '\$2' WITH GRANT OPTION;\"" >> /opt/bitnami/mysql/scripts/myscript.sh && \
|
||||
rm -rf /tmp/* /opt/bitnami/mysql/data /opt/bitnami/ctlscript.sh && \
|
||||
mkdir /opt/bitnami/mysql/logs && ln -s /dev/stdout /opt/bitnami/mysql/logs/mysqld.log && \
|
||||
mkdir /opt/bitnami/mysql/conf.defaults && \
|
||||
mv /opt/bitnami/mysql/my.cnf /opt/bitnami/mysql/conf.defaults/ && \
|
||||
ln -s /opt/bitnami/mysql/conf/my.cnf /opt/bitnami/mysql/my.cnf && \
|
||||
ln -s /opt/bitnami/mysql/conf /conf && \
|
||||
ln -s /opt/bitnami/mysql/data /data && \
|
||||
ln -s /opt/bitnami/mysql/logs /logs && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get --purge autoremove -qy wget && apt-get clean && rm -rf /var/lib/apt && rm -rf /var/cache/apt/archives/*
|
||||
ENV BITNAMI_APP_NAME mariadb
|
||||
ENV BITNAMI_APP_VERSION 5.5.42-0
|
||||
ENV BITNAMI_APP_DIRNAME mysql
|
||||
|
||||
ADD install.sh /tmp/install.sh
|
||||
ADD post-install.sh /tmp/post-install.sh
|
||||
|
||||
# We need to specify a mysql password since the installer initializes the database, but it is
|
||||
# removed in the post install and re-initialized at runtime.
|
||||
RUN bash /tmp/install.sh\
|
||||
--base_password bitnami --mysql_password bitnami --mysql_allow_all_remote_connections 1 --disable-components common
|
||||
|
||||
ENV PATH /opt/bitnami/mysql/bin:$PATH
|
||||
EXPOSE 3306
|
||||
|
||||
24
bitnami/mariadb/install.sh
Normal file
24
bitnami/mariadb/install.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
: ${BITNAMI_APP_DIRNAME=$BITNAMI_APP_NAME};
|
||||
|
||||
echo "===> Downloading Bitnami $BITNAMI_APP_NAME-$BITNAMI_APP_VERSION installer"
|
||||
apt-get update -q && DEBIAN_FRONTEND=noninteractive apt-get install -qy wget
|
||||
wget -q --no-check-certificate \
|
||||
https://downloads.bitnami.com/files/download/$BITNAMI_APP_NAME/\
|
||||
bitnami-$BITNAMI_APP_NAME-$BITNAMI_APP_VERSION-linux-x64-installer.run \
|
||||
-O /tmp/installer.run
|
||||
|
||||
echo "===> Running Bitnami $BITNAMI_APP_NAME-$BITNAMI_APP_VERSION installer"
|
||||
chmod +x /tmp/installer.run
|
||||
/tmp/installer.run --mode unattended --prefix /opt/bitnami $@
|
||||
/opt/bitnami/$BITNAMI_APP_DIRNAME/scripts/ctl.sh stop > /dev/null
|
||||
|
||||
if [ -f "/tmp/post-install.sh" ]; then
|
||||
sh /tmp/post-install.sh /opt/bitnami/$BITNAMI_APP_DIRNAME
|
||||
fi
|
||||
|
||||
echo "===> Cleaning up"
|
||||
rm -rf /tmp/* /opt/bitnami/ctlscript.sh /opt/bitnami/config
|
||||
DEBIAN_FRONTEND=noninteractive apt-get --purge autoremove -qy wget
|
||||
apt-get clean && rm -rf /var/lib/apt && rm -rf /var/cache/apt/archives/*
|
||||
21
bitnami/mariadb/post-install.sh
Normal file
21
bitnami/mariadb/post-install.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
INSTALL_DIR=$1
|
||||
cd $INSTALL_DIR
|
||||
|
||||
# remove unneeded files
|
||||
rm -rf data scripts/myscript.sh scripts/myscript-upgrade.sh
|
||||
|
||||
# set up logging to stdout
|
||||
mkdir logs
|
||||
ln -s /dev/stdout logs/mysqld.log
|
||||
|
||||
# set up default config
|
||||
mkdir conf.defaults
|
||||
mv my.cnf conf.defaults/
|
||||
ln -s $INSTALL_DIR/conf/my.cnf my.cnf
|
||||
|
||||
# symlink mount points at root to install dir
|
||||
ln -s $INSTALL_DIR/conf /conf
|
||||
ln -s $INSTALL_DIR/data /data
|
||||
ln -s $INSTALL_DIR/logs /logs
|
||||
Reference in New Issue
Block a user