adding TZ + enhance terminal output

This commit is contained in:
a-sansara 2016-08-04 03:00:33 +02:00
parent e185c732dc
commit 05585bc223
20 changed files with 56 additions and 32 deletions

View File

@ -45,7 +45,7 @@ rm -f to force stop running container before removing
#### remove none images
```
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
docker rmi $(docker images | grep "^<none>" | awk "{print \$3}")
```
#### remove all volumes

View File

@ -4,13 +4,12 @@ MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
RUN bash /scripts/install.sh
ENV SHENV_NAME=Apache \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=docker-site.dev \
FIX_OWNERSHIP=1
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
VOLUME /app
RUN bash /scripts/install.sh

View File

@ -13,7 +13,7 @@ DOCKBUILD=$(basename $DOCKDIR)
cd $DOCKDIR
echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent}* /"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent} /"
echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n
"

Binary file not shown.

View File

@ -11,4 +11,3 @@ sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf
sed -i 's#\#LoadModule rewrite_module modules/mod_rewrite.so#LoadModule rewrite_module modules/mod_rewrite.so#' /etc/apache2/httpd.conf
sed -ir 's/expose_php = On/expose_php = Off/' /etc/php5/php.ini
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
rm -f /scripts/pre-init.d/50-example.sh

View File

@ -3,5 +3,5 @@
. /scripts/common.sh
echo "[[ Starting Apache Daemon ]]"
initTitle "Starting" "Apache Daemon"
httpd -D FOREGROUND

View File

@ -4,11 +4,11 @@ MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
RUN bash /scripts/install.sh
ENV SHENV_NAME=Mysql \
SHENV_COLOR=132
EXPOSE 3306
VOLUME ["/var/lib/mysql", "/dump"]
RUN bash /scripts/install.sh

View File

@ -13,7 +13,7 @@ DOCKBUILD=$(basename $DOCKDIR)
cd $DOCKDIR
echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent}* /"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent} /"
echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n
"

Binary file not shown.

View File

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

View File

@ -1,10 +1,12 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
. /scripts/util.sh
function mysql.secure(){
chown mysql:mysql $1
sleep 5
echo "[[ SECURING DATABASE ]]";
initTitle "SECURING" "DATABASE"
echo "please wait."
sleep 5
rm -f $1
@ -18,7 +20,7 @@ fi
if [ ! -d /var/lib/mysql/mysql ]; then
echo "[[ Initialize DB ]]"
initTitle "Initialize" "DATABASE"
chown -R mysql:mysql /var/lib/mysql
mysql_install_db --user=mysql --verbose=1 --basedir=/usr --datadir=/var/lib/mysql --rpm > /dev/null
@ -61,10 +63,10 @@ GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PA
mysql.secure $tfile &
echo "[[ Starting Mysql Daemon ]]"
initTitle "Starting" "Mysql Daemon"
exec /usr/bin/mysqld --user=mysql --console --init-file="$tfile"
else
echo "[[ Skipping DB init ]]"
echo "[[ Starting Mysql Daemon ]]"
initTitle "Skipping" "DB init"
initTitle "Starting" "Mysql Daemon"
fi

View File

@ -4,11 +4,14 @@ MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
RUN apk --update add bash && bash /scripts/install.sh
ENV TERM=xterm \
SHENV_CTX=LOCAL \
SHENV_NAME=Alpine \
SHENV_COLOR=97
SHENV_COLOR=97 \
TZ=Europe/Paris
VOLUME /app
RUN apk --update add bash && bash /scripts/install.sh
ENTRYPOINT ["/scripts/main.sh"]

View File

@ -13,7 +13,7 @@ DOCKBUILD=$(basename $DOCKDIR)
cd $DOCKDIR
echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent}* /"
tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent} /"
echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n
"

Binary file not shown.

View File

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

View File

@ -0,0 +1,17 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
if [ ! -z "$TZ" ] && [ -f "/usr/share/zoneinfo/$TZ" ]; then
echo "$TZ" > /etc/TZ
cp "/usr/share/zoneinfo/$TZ" "/etc/localtime"
apk del tzdata
if [ ! "${TZ///*/}" = "$TZ" ]; then
mkdir -p "/usr/share/zoneinfo/${TZ///*/}"
fi
cp /etc/localtime "/usr/share/zoneinfo/$TZ"
echo -e "\033[1;38;5;203mTIMEZONE : $TZ"
date
echo -en "\033[m"
else
echo -e "\033[1;38;5;203mNO DEFINED TIMEZONE"
fi

View File

@ -1,4 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
#~ cp -fa "/app/localtime" "/etc/localtime"
rm -f /var/cache/apk/*
chown -R root:root /scripts/

View File

@ -0,0 +1,4 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
echo -e "\ncontainer builded by \033[1;38;5;209mpluie.org\033[m - \033[1;38;5;32mhttps://git.pluie.org/pluie/docker-images\033[m\n"

View File

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

View File

@ -21,11 +21,19 @@ function bash_prompt() {
export PS1="${Cdate}\t ${Cwhite}${Cctx} DOCKER ${SHENV_CTX} ${Cname} ${SHENV_NAME} ${Coff} ${Cuser}\u${Chost}@\h ${Cpath}\w ${Csymbol}\$ ${Coff}"
}
function initTitle(){
local data=${1:-''}
if [ ! -z "$2" ]; then
data="$data\033[1;38;5;97m $2 "
fi
echo -e "\n\033[1;33m[[ \033[1;38;5;30m$data\033[1;33m]]\033[m"
}
function preInit(){
for i in ls $1/*.sh
do
if [ -e "${i}" ]; then
echo "[[ Processing $i ]]"
initTitle "Processing" "$i"
. "${i}"
fi
done