all images from offical alpine:3.4

This commit is contained in:
a-sansara 2016-07-29 13:51:56 +02:00
parent 1c7306527f
commit 775cfba38c
17 changed files with 52 additions and 23 deletions

View File

@ -4,8 +4,8 @@ based images for Docker
## Available Images ## Available Images
- __pluie/alpine__ ( < 10 MB) Alpine/3.2 - __pluie/alpine__ ( < 10 MB) Alpine/3.4
- __pluie/alpine-apache__ ( ~ 37 MB) Apache/2.4.16 Php/5.6.21 - __pluie/alpine-apache__ ( ~ 37 MB) Apache/2.4.23 Php/5.6.24
- __pluie/alpine-mysql__ ( ~ 160 MB) Mysql/5.5.47 [MariaDB] - __pluie/alpine-mysql__ ( ~ 160 MB) Mysql/5.5.47 [MariaDB]
## Base Image Structure ## Base Image Structure

View File

@ -6,7 +6,10 @@ ADD files.tar /scripts
RUN bash /scripts/install.sh RUN bash /scripts/install.sh
ENV SHENV_NAME=Apache SHENV_COLOR=67 HTTP_SERVER_NAME=docker-site.dev FIX_OWNERSHIP=1 ENV SHENV_NAME=Apache \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=docker-site.dev \
FIX_OWNERSHIP=1
EXPOSE 80 EXPOSE 80

View File

@ -1,6 +1,6 @@
# pluie/alpine-apache # pluie/alpine-apache
Extend pluie/alpine with apache 2.4.16 Extend pluie/alpine with apache 2.4.23
- error log are attached to stdout - error log are attached to stdout
- no need port redirection - no need port redirection

Binary file not shown.

View File

@ -2,6 +2,6 @@
# pluie/docker-images - a-Sansara (https://github.com/a-sansara) # pluie/docker-images - a-Sansara (https://github.com/a-sansara)
apk --update add apache2 \ apk --update add apache2 \
php-apache2 php-cli php-phar php-zlib php-zip php-ctype php-mysqli php-pdo_mysql php-xml \ php5-apache2 php5-cli php5-phar php5-zlib php5-zip php5-ctype php5-mysqli php5-pdo_mysql php5-xml \
php-opcache php-pdo php-json php-curl php-gd php-mcrypt php-openssl \ php5-opcache php5-pdo php5-json php5-curl php5-gd php5-mcrypt php5-openssl \
# php-pdo_odbc php-soap php-pgsql # php-pdo_odbc php-soap php-pgsql

View File

@ -6,6 +6,6 @@ chown -R 1000:apache /app/www
chmod -R 755 /scripts/pre-init.d chmod -R 755 /scripts/pre-init.d
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/www"#g' /etc/apache2/httpd.conf sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/www"#g' /etc/apache2/httpd.conf
sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf
sed -ir 's/expose_php = On/expose_php = Off/' /etc/php/php.ini sed -ir 's/expose_php = On/expose_php = Off/' /etc/php5/php.ini
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
rm -f /scripts/pre-init.d/50-example.sh rm -f /scripts/pre-init.d/50-example.sh

View File

@ -6,7 +6,8 @@ ADD files.tar /scripts
RUN bash /scripts/install.sh RUN bash /scripts/install.sh
ENV SHENV_NAME=Mysql SHENV_COLOR=132 ENV SHENV_NAME=Mysql \
SHENV_COLOR=132
EXPOSE 3306 EXPOSE 3306

Binary file not shown.

View File

@ -1,2 +1,5 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
chown -R root:root /scripts/ chown -R root:root /scripts/
rm -f /scripts/pre-init.d/50-example.sh rm -f /scripts/pre-init.d/50-example.sh

View File

@ -2,6 +2,4 @@
# pluie/docker-images - a-Sansara (https://github.com/a-sansara) # pluie/docker-images - a-Sansara (https://github.com/a-sansara)
. /scripts/common.sh . /scripts/common.sh
echo "[[ Starting Mysql Daemon ]]"
exec /usr/bin/mysqld --user=mysql --console exec /usr/bin/mysqld --user=mysql --console

View File

@ -1,15 +1,26 @@
#!/bin/bash #!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara) # pluie/docker-images - a-Sansara (https://github.com/a-sansara)
function mysql.secure(){
chown mysql:mysql $1
sleep 5
echo "[[ SECURING DATABASE ]]";
echo "please wait."
sleep 5
rm -f $1
echo "done"
}
if [ ! -d "/run/mysqld" ]; then if [ ! -d "/run/mysqld" ]; then
mkdir -p /run/mysqld mkdir -p /run/mysqld
chown -R mysql:mysql /run/mysqld chown -R mysql:mysql /run/mysqld
fi fi
if [ ! -d /var/lib/mysql/mysql ]; then if [ ! -d /var/lib/mysql/mysql ]; then
echo "[[ Initialize DB ]]" echo "[[ Initialize DB ]]"
chown -R mysql:mysql /var/lib/mysql chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql > /dev/null mysql_install_db --user=mysql --verbose=1 --basedir=/usr --datadir=/var/lib/mysql --rpm > /dev/null
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
MYSQL_ROOT_PASSWORD=`pwgen -y -s 18 1` MYSQL_ROOT_PASSWORD=`pwgen -y -s 18 1`
@ -24,20 +35,19 @@ if [ ! -d /var/lib/mysql/mysql ]; then
return 1 return 1
fi fi
cat << EOF > $tfile cat <<-EOF > $tfile
USE mysql; UPDATE mysql.user SET password=PASSWORD('$MYSQL_ROOT_PASSWORD') WHERE user='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; DELETE FROM mysql.user WHERE user='root' AND host NOT IN ('localhost', '127.0.0.1', '::1', '$(hostname)');
UPDATE user SET password=PASSWORD("$MYSQL_ROOT_PASSWORD") WHERE user='root'; DELETE FROM mysql.user WHERE user='';
DELETE FROM mysql.db WHERE db='test' OR db='test\_%';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
UPDATE user SET password=PASSWORD("") WHERE user='root' AND host='localhost'; UPDATE mysql.user SET password=PASSWORD("") WHERE user='root' AND host='localhost';
EOF EOF
if [ ! -z "$MYSQL_DATABASE" ]; then if [ ! -z "$MYSQL_DATABASE" ]; then
echo "[[ CREATE DATABASE $MYSQL_DATABASE ]]";
echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
fi fi
if [ "$MYSQL_USER" != "" ] && [ "$MYSQL_USER" != 'root' ]; then if [ "$MYSQL_USER" != "" ] && [ "$MYSQL_USER" != 'root' ]; then
echo "[[ CREATE USER $MYSQL_USER ]]";
echo " echo "
CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'; CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';
CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
@ -47,6 +57,14 @@ GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'localhost' IDENTIFIED BY '$
GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
fi fi
fi fi
/usr/bin/mysqld --user=mysql --bootstrap --skip-grant-tables=0 --verbose=0 < $tfile echo "FLUSH PRIVILEGES;" >> $tfile
rm -f $tfile
mysql.secure $tfile &
echo "[[ Starting Mysql Daemon ]]"
exec /usr/bin/mysqld --user=mysql --console --init-file="$tfile"
else
echo "[[ Skipping DB init ]]"
echo "[[ Starting Mysql Daemon ]]"
fi fi

View File

@ -1,4 +1,4 @@
FROM gliderlabs/alpine:3.2 FROM alpine:3.4
MAINTAINER a-Sansara https://github.com/a-sansara MAINTAINER a-Sansara https://github.com/a-sansara
@ -6,6 +6,9 @@ ADD files.tar /scripts
RUN apk --update add bash && bash /scripts/install.sh RUN apk --update add bash && bash /scripts/install.sh
ENV TERM=xterm SHENV_CTX=LOCAL SHENV_NAME=Alpine SHENV_COLOR=97 ENV TERM=xterm \
SHENV_CTX=LOCAL \
SHENV_NAME=Alpine \
SHENV_COLOR=97
ENTRYPOINT ["/scripts/main.sh"] ENTRYPOINT ["/scripts/main.sh"]

View File

@ -6,7 +6,7 @@ This Image provide a Linux Alpine distribution with :
- curl - curl
- nano as editor - nano as editor
Base image : [gliderlabs/alpine:3.2] (https://registry.hub.docker.com/u/gliderlabs/alpine/) Base image : [alpine:3.4] (https://hub.docker.com/_/alpine/)
This project come with a structure to facilitate further images (like pluie/alpine-apache & pluie/alpine-mysql) This project come with a structure to facilitate further images (like pluie/alpine-apache & pluie/alpine-mysql)

Binary file not shown.

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
apk --update add nano curl apk --update add nano curl

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
rm -f /var/cache/apk/* rm -f /var/cache/apk/*

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# ls -la /scripts # ls -la /scripts
chown -R root:root /scripts/ chown -R root:root /scripts/