diff --git a/pluie/libyaml/Dockerfile b/pluie/libyaml/Dockerfile index cac7ffe..94f016d 100644 --- a/pluie/libyaml/Dockerfile +++ b/pluie/libyaml/Dockerfile @@ -1,7 +1,7 @@ # @app pluie/libyaml # @author a-Sansara https://git.pluie.org/pluie/docker-images -FROM pluie/libecho +FROM pluie/ubuntu MAINTAINER a-Sansara https://github.com/a-sansara @@ -11,4 +11,4 @@ ENV SHENV_NAME=libyaml \ SHENV_COLOR=36 \ TZ=Europe/Paris -RUN bash /scripts/install.sh +RUN /bin/bash /scripts/install.sh diff --git a/pluie/libyaml/files.tar b/pluie/libyaml/files.tar index 93b1e15..4c983ba 100644 Binary files a/pluie/libyaml/files.tar and b/pluie/libyaml/files.tar differ diff --git a/pluie/libyaml/install.d/11-vala.sh b/pluie/libyaml/install.d/11-vala.sh deleted file mode 100644 index 3859f17..0000000 --- a/pluie/libyaml/install.d/11-vala.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# @app pluie/libyaml -# @author a-Sansara https://git.pluie.org/pluie/docker-images - -apk add yaml-dev libgee-dev \ -&& git clone https://github.com/pluie-org/lib-yaml.git \ -&& cd lib-yaml/ \ -&& meson --prefix=/usr ./ build \ -&& ninja install -C build \ -&& ./build.sh diff --git a/pluie/libyaml/install.d/20-vala.sh b/pluie/libyaml/install.d/20-vala.sh new file mode 100644 index 0000000..a6ae42d --- /dev/null +++ b/pluie/libyaml/install.d/20-vala.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# @app pluie/libyaml +# @author a-Sansara https://git.pluie.org/pluie/docker-images +export DEBCONF_NONINTERACTIVE_SEEN=true +export DEBIAN_FRONTEND=noninteractive +echo "Updating system..." +apt install -y glib-2.0-dev libgee-0.8-dev libyaml-dev git gcc valac meson +mkdir /home/repo; cd $_; +echo "Installing pluie-echo dependency" +git clone https://git.pluie.org/pluie/libpluie-echo.git +cd libpluie-echo +meson --prefix=/usr ./ build +ninja install -C build +pkg-config --libs pluie-echo-0.2 diff --git a/pluie/libyaml/main.sh b/pluie/libyaml/main.sh index 9c52d37..c157b5d 100755 --- a/pluie/libyaml/main.sh +++ b/pluie/libyaml/main.sh @@ -1,10 +1,10 @@ #!/bin/bash -# @app pluie/libecho +# @app pluie/libyaml # @author a-Sansara https://git.pluie.org/pluie/docker-images . /scripts/common.sh -initTitle "Vala shared lib pluie-yaml-0.4" "Sample" -cd /lib-yaml/bin/ -./yaml-imports +cd /home/repo/lib-yaml +echo "try any samples" bash + diff --git a/pluie/libyaml/pre-init.d/11-vala.sh b/pluie/libyaml/pre-init.d/11-vala.sh deleted file mode 100644 index 9b3371d..0000000 --- a/pluie/libyaml/pre-init.d/11-vala.sh +++ /dev/null @@ -1,4 +0,0 @@ -# cd /lib-yaml/samples -# valac -v --pkg gee-0.8 --pkg pluie-echo-0.2 --pkg pluie-yaml-0.4 yaml-imports.vala -cd /lib-yaml/ -./build.sh diff --git a/pluie/libyaml/pre-init.d/50-builder.sh b/pluie/libyaml/pre-init.d/50-builder.sh new file mode 100644 index 0000000..9220f8c --- /dev/null +++ b/pluie/libyaml/pre-init.d/50-builder.sh @@ -0,0 +1,4 @@ +cd /home/repo +git clone https://git.pluie.org/pluie/lib-yaml.git +cd lib-yaml +./build.sh diff --git a/pluie/ubuntu/Dockerfile b/pluie/ubuntu/Dockerfile new file mode 100644 index 0000000..9904d82 --- /dev/null +++ b/pluie/ubuntu/Dockerfile @@ -0,0 +1,20 @@ +# @app pluie/libyaml +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +FROM ubuntu:latest + +MAINTAINER a-Sansara https://github.com/a-sansara + +ADD files.tar /scripts + +ENV TERM=xterm \ + SHENV_NAME=ubuntu \ + SHENV_COLOR=97 \ + SHENV_CTX=LOCAL \ + TZ=Europe/Paris + +VOLUME /app + +RUN /bin/bash /scripts/install.sh + +ENTRYPOINT ["/scripts/main.sh"] diff --git a/pluie/ubuntu/README.md b/pluie/ubuntu/README.md new file mode 100644 index 0000000..12c6e01 --- /dev/null +++ b/pluie/ubuntu/README.md @@ -0,0 +1,109 @@ +# pluie/alpine + +- [index][1] +- [pluie/alpine][2] ( ~ 9 MB ) Alpine/3.5 + - [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.25 Php/5.6.30 + - [pluie/alpine-apache-fpm][7] ( ~ 51 MB ) Apache/2.4.25 Php/5.6.30 Fpm + - [pluie/alpine-symfony][6] ( ~ 83 MB ) Symfony2.8 or 3.2 + - [pluie/alpine-apache-php7][8] ( ~ 45 MB ) Apache/2.4.25 Php/7.0.16 + - [pluie/alpine-symfony-php7][9] ( ~ 77 MB ) Symfony2.8 or 3.2 Php/7.0.16 + - [pluie/alpine-mysql][4] ( ~181 MB ) Mysql/5.6 ( MariaDB ) + - [pluie/libecho][10] ( ~288 MB ) Vala 0.34.2 pluie-echo-0.2 +- [pluie/ubuntu][12] ( ~ 9 MB ) Ubuntu 18.04 + - [pluie/libyaml][11] ( ~535 MB ) Vala 0.36.2 pluie-yaml-0.4 +- [docker tips][5] + +This Image provide a Linux Ubuntu LTS distribution with : +- fully functionnal & colorized terminal +- bash +- curl +- nano as editor + +Base image : [ubuntu](https://hub.docker.com/_/ubuntu/) + +This project come with a structure to facilitate further images (like pluie/libyaml) + +## Image Size + +- very small image ~ 9 MB + + +## Image Usage + +``` +$ docker run --name ubuntu -it pluie/ubuntu +``` + +## Image Structure + +``` +project/ + | + |-- install.d/ # deployed in /scripts on target container + | | # launch on docker image building process + | | # XX-name.sh - low XX are run first + | |-- 00-util.sh + | |-- 40-fix.sh + | + |-- pre-init.d/ # deployed in /scripts on target container + | | # launch on docker container running process + | |-- 50-builder.sh + | + |-- build # build docker image : ./build [TAG] + |-- common.sh # don't modify - sourced by main.sh to execute pre-init.d scripts first + |-- install.sh # don't modify - execute install.d scripts on docker building process + |-- main.sh # source common.sh then execute entry point instruction + |-- util.sh # sourced by common.sh +``` + +you can easily create your own images based on this structure. +keep an eye to pluie/libyalm wich extend pluie/ubuntu + + +## Extend pluie/ubuntu Image + +RUN instructions are minimized +on extended image you only need to use : +``` +RUN bash /scripts/install.sh +``` +add your packages in a script in install.d directory +keep name below 40 because install.d/40-fix.sh clean package repository +each extended image inherit install.d && pre-init.d scripts + +extended images doesn't need to define ENTRYPOINT +you can keep intact build script in each extended project +manage your install & init instruction in install.d & pre-init.d directory +and write your own main.sh script + +Docker file example (from pluie/libyaml) + +``` +# @app pluie/libyaml +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +FROM pluie:ubuntu + +MAINTAINER a-Sansara https://github.com/a-sansara + +ADD files.tar /scripts + +ENV SHENV_NAME=libyaml \ + SHENV_COLOR=36 \ + TZ=Europe/Paris + +RUN bash /scripts/install.sh +``` + + [1]: https://github.com/pluie-org/docker-images + [2]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine + [3]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache + [4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-mysql + [7]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache-fpm + [5]: https://github.com/pluie-org/docker-images/blob/master/DOCKER.md + [6]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-symfony + [8]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache-php7 + [9]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-symfony-php7 + [10]: https://github.com/pluie-org/docker-images/tree/master/pluie/libecho + [11]: https://github.com/pluie-org/docker-images/tree/master/pluie/libyaml + [12]: https://github.com/pluie-org/docker-images/tree/master/pluie/ubuntu diff --git a/pluie/ubuntu/build b/pluie/ubuntu/build new file mode 100755 index 0000000..8cafaab --- /dev/null +++ b/pluie/ubuntu/build @@ -0,0 +1,22 @@ +#!/bin/bash +# @app pluie/alpine-apache +# @author a-Sansara https://git.pluie.org/pluie/docker-images + + Ctitle="\033[1;38;5;15;1;48;5;30m" + Citem="\033[1;38;5;36m" + Coff="\033[m" + DOCKDIR=$(dirname "$(readlink -f ${BASH_SOURCE[0]})") +DOCKBUILD=$(basename $DOCKDIR) + DOCKREPO=$(basename $(dirname $DOCKDIR)) + DOCKTAG=${1:-"latest"} + TMPPWD=$(pwd) + indent=" " +cd $DOCKDIR +echo -e "\n ${Ctitle} Preparing files : ${Coff}${Citem}\n" + +tar -cvf files.tar *.sh pre-init.d/ install.d/ | sed "s/^/${indent}↠ /" + +echo -e "\n ${Ctitle} Proceed Dockerfile build : ${Coff}\n +" +sudo docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/" +cd $TMPPWD diff --git a/pluie/ubuntu/common.sh b/pluie/ubuntu/common.sh new file mode 100644 index 0000000..ce3526e --- /dev/null +++ b/pluie/ubuntu/common.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# @app pluie/ubuntu +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +. /scripts/util.sh + +# execute any pre-init scripts wich is useful for images based on this image +# /scripts/pre-init.d/XX-name.sh +# low XX are run first +preInit "/scripts/pre-init.d" diff --git a/pluie/ubuntu/files.tar b/pluie/ubuntu/files.tar new file mode 100644 index 0000000..4a7e404 Binary files /dev/null and b/pluie/ubuntu/files.tar differ diff --git a/pluie/ubuntu/install.d/00-util.sh b/pluie/ubuntu/install.d/00-util.sh new file mode 100644 index 0000000..d671735 --- /dev/null +++ b/pluie/ubuntu/install.d/00-util.sh @@ -0,0 +1,4 @@ +export DEBCONF_NONINTERACTIVE_SEEN=true +export DEBIAN_FRONTEND=noninteractive +apt update +apt install -y nano curl tzdata diff --git a/pluie/ubuntu/install.d/10-ps1.sh b/pluie/ubuntu/install.d/10-ps1.sh new file mode 100644 index 0000000..bbaea28 --- /dev/null +++ b/pluie/ubuntu/install.d/10-ps1.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# @app pluie/alpine +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +if [ ! -f /root/.bash_ps1 ]; then + cat <> /root/.bashrc +if [ -f ~/.bash_ps1 ]; then + . ~/.bash_ps1 +fi +EOF + sed -n '1,22 p' /scripts/util.sh > /root/.bash_ps1 + echo "bash_prompt" >> /root/.bash_ps1 +fi diff --git a/pluie/ubuntu/install.d/30-ts.sh b/pluie/ubuntu/install.d/30-ts.sh new file mode 100644 index 0000000..752d217 --- /dev/null +++ b/pluie/ubuntu/install.d/30-ts.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# @app pluie/alpine +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +if [ ! -z "$TZ" ] && [ -f "/usr/share/zoneinfo/$TZ" ]; then + echo "$TZ" > /etc/TZ + cp "/usr/share/zoneinfo/$TZ" "/etc/localtime" + 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 diff --git a/pluie/ubuntu/install.d/40-fix.sh b/pluie/ubuntu/install.d/40-fix.sh new file mode 100644 index 0000000..600995e --- /dev/null +++ b/pluie/ubuntu/install.d/40-fix.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# @app pluie/alpine +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +apt clean +chown -R root:root /scripts/ diff --git a/pluie/ubuntu/install.sh b/pluie/ubuntu/install.sh new file mode 100644 index 0000000..34e9ff5 --- /dev/null +++ b/pluie/ubuntu/install.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# @app pluie/ubuntu +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +. /scripts/util.sh +preInit "/scripts/install.d" diff --git a/pluie/ubuntu/main.sh b/pluie/ubuntu/main.sh new file mode 100755 index 0000000..e55763c --- /dev/null +++ b/pluie/ubuntu/main.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# @app pluie/alpine +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +. /scripts/common.sh +bash diff --git a/pluie/ubuntu/pre-init.d/50-builder.sh b/pluie/ubuntu/pre-init.d/50-builder.sh new file mode 100644 index 0000000..245fce7 --- /dev/null +++ b/pluie/ubuntu/pre-init.d/50-builder.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# @app pluie/ubuntu +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +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" diff --git a/pluie/ubuntu/util.sh b/pluie/ubuntu/util.sh new file mode 100644 index 0000000..4ce801e --- /dev/null +++ b/pluie/ubuntu/util.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# @app pluie/alpine +# @author a-Sansara https://git.pluie.org/pluie/docker-images + +function bash_prompt() { + local Cenvcode="243" + if [ "$SHENV_CTX" = "INT" ]; then + local Cenvcode="202" + elif [ "$SHENV_CTX" = "PROD" ]; then + local Cenvcode="160" + fi + local Cdate="\[\033[1;33m\]" + local Cctx="\[\033[1;48;5;${Cenvcode}m\]" + local Cname="\[\033[1;48;5;${SHENV_COLOR}m\]" + local Cpath="\[\033[1;38;5;36m\]" + local Cwhite="\[\033[1;38;5;15m\]" + local Chost="\[\033[1;38;5;15m\]" + local Csymbol="\[\033[1;38;5;15m\]" + local Cuser="\[\033[1;38;5;203m\]" + local Coff="\[\033[m\]" + 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 + initTitle "Processing" "$i" + . "${i}" + fi + done +}