add base ubuntu lts + update libyaml with base ubuntu

This commit is contained in:
a-Sansara 2018-08-14 02:21:22 +02:00
parent 2e5e401c85
commit e946a39e7c
20 changed files with 282 additions and 20 deletions

View File

@ -1,7 +1,7 @@
# @app pluie/libyaml # @app pluie/libyaml
# @author a-Sansara https://git.pluie.org/pluie/docker-images # @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/libecho FROM pluie/ubuntu
MAINTAINER a-Sansara https://github.com/a-sansara MAINTAINER a-Sansara https://github.com/a-sansara
@ -11,4 +11,4 @@ ENV SHENV_NAME=libyaml \
SHENV_COLOR=36 \ SHENV_COLOR=36 \
TZ=Europe/Paris TZ=Europe/Paris
RUN bash /scripts/install.sh RUN /bin/bash /scripts/install.sh

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
# @app pluie/libecho # @app pluie/libyaml
# @author a-Sansara https://git.pluie.org/pluie/docker-images # @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh . /scripts/common.sh
initTitle "Vala shared lib pluie-yaml-0.4" "Sample" cd /home/repo/lib-yaml
cd /lib-yaml/bin/ echo "try any samples"
./yaml-imports
bash bash

View File

@ -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

View File

@ -0,0 +1,4 @@
cd /home/repo
git clone https://git.pluie.org/pluie/lib-yaml.git
cd lib-yaml
./build.sh

20
pluie/ubuntu/Dockerfile Normal file
View File

@ -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"]

109
pluie/ubuntu/README.md Normal file
View File

@ -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

22
pluie/ubuntu/build Executable file
View File

@ -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

10
pluie/ubuntu/common.sh Normal file
View File

@ -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"

BIN
pluie/ubuntu/files.tar Normal file

Binary file not shown.

View File

@ -0,0 +1,4 @@
export DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y nano curl tzdata

View File

@ -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 <<EOF >> /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

View File

@ -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

View File

@ -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/

6
pluie/ubuntu/install.sh Normal file
View File

@ -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"

6
pluie/ubuntu/main.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
bash

View File

@ -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"

40
pluie/ubuntu/util.sh Normal file
View File

@ -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
}