Compare commits

...

35 Commits
1.0 ... master

Author SHA1 Message Date
a-Sansara
09b2d8f1a0 update summary menu in all readme 2018-08-14 02:43:27 +02:00
a-Sansara
e946a39e7c add base ubuntu lts + update libyaml with base ubuntu 2018-08-14 02:21:22 +02:00
a-Sansara
2e5e401c85 adding vala shared lib pluie-yaml-0.4 2018-08-08 01:18:37 +02:00
a-Sansara
b525151f68 update libecho to version 0.2 2017-11-18 00:00:49 +01:00
a-Sansara
db06c5d107 update libecho README 2017-11-07 02:24:34 +01:00
a-Sansara
ffe9dc8cb0 adding vala shared lib libpluie-echo-0.1 2017-11-05 15:22:53 +01:00
a-sansara
43ca75bef6 fix TZ inheritance on install & init process 2017-07-05 21:20:53 +02:00
a-sansara
32093e01d6 amend 2017-03-18 02:24:19 +01:00
a-sansara
232ea7a8da update all images with alpine 3.5 - remove edge for php7 versions 2017-03-18 02:16:10 +01:00
a-sansara
28533f0cce fixing symfony init + enabling gateway ip on dev 2017-03-16 04:35:46 +01:00
a-sansara
9cabf4d736 Merge branch 'master' of https://git.pluie.org/pluie/docker-images 2017-03-15 04:41:30 +01:00
a-sansara
3951d9deb1 fix apache $WWW-DIR creation 2017-03-15 04:35:10 +01:00
a-sansara
17163c9b3d add fpm-php7 2017-02-16 14:30:26 +01:00
a-sansara
9852484282 update readme 2017-01-30 03:31:26 +01:00
a-sansara
02ad396a6a fix php7 & add symfony-php7 2017-01-30 02:58:46 +01:00
a-sansara
88e1b70c4d update README 2017-01-30 00:33:26 +01:00
a-sansara
125eb03dee add files.tar for automated build 2017-01-30 00:16:30 +01:00
a-sansara
7ddff5a239 amend 2017-01-30 00:12:54 +01:00
a-sansara
b92bff465d adding pluie/alpine-apache-php7 2017-01-29 23:44:52 +01:00
a-sansara
0dd7c33a71 fix mariadb version in readme 2016-08-13 22:31:02 +02:00
a-sansara
7585f595c3 update readme + fix install apache & apache-fpm 2016-08-12 22:31:35 +02:00
a-sansara
48d9fc2840 manage apache-fpm + fix alpine-symfony 2016-08-12 04:18:48 +02:00
a-sansara
79cb538ef5 update README 2016-08-09 04:09:53 +02:00
a-sansara
6f22d95e79 add pluie/alpine-symfony image 2016-08-09 03:45:54 +02:00
a-sansara
28334d5314 amend wordpress volume 2016-08-06 17:51:43 +02:00
a-sansara
4824f4aedf amend create ps1 2016-08-06 17:37:41 +02:00
a-sansara
7dfd83b51c homogenize header 2016-08-06 02:29:06 +02:00
a-sansara
05585bc223 adding TZ + enhance terminal output 2016-08-04 03:11:07 +02:00
a-sansara
e185c732dc mysql : add various scripts
all   : fix terminal ENV context and add doc nav
2016-08-03 01:38:18 +02:00
a-sansara
fc8be7c6f4 all : fix not printable color sequence in terminal 2016-08-01 03:25:53 +02:00
a-sansara
8efe12893d apache : fix break install 3:2 > 3.4 2016-07-29 17:09:39 +02:00
a-sansara
f4f492ae66 update readme & build 2016-07-29 15:28:15 +02:00
a-sansara
300de09c5a all : fix inputrc + mysql : add createdb script 2016-07-29 15:22:12 +02:00
a-sansara
775cfba38c all images from offical alpine:3.4 2016-07-29 14:04:25 +02:00
a-Sansara
1c7306527f Update README.md 2016-07-29 11:48:56 +02:00
116 changed files with 2419 additions and 133 deletions

198
DOCKER.md Normal file
View File

@ -0,0 +1,198 @@
## Docker
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
### Networking
#### create network
```
docker network create \
--subnet=172.22.0.0/16 \
--gateway=172.22.0.1 \
-o "com.docker.network.bridge.name"="home0" \
home0
```
#### inspect ip
```
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container
```
#### /etc/hosts
```
# > DOCKER - bridge home0
172.22.0.2 db.docker
172.22.0.3 gogs.docker
172.22.0.4 pma.docker
172.22.0.5 bo-payment.docker
172.22.0.6 wordpress.docker
172.22.0.7 fpm.docker
172.22.0.8 symfony.docker
172.22.0.9 php7.docker
# <
```
### Util
#### remove all container
```
docker rm $(docker ps -a -q)
```
rm -v to also remove volume
rm -f to force stop running container before removing
#### remove none images
```
docker rmi $(docker images | grep "^<none>" | awk "{print \$3}")
```
#### remove all volumes
```
docker volume rm $(docker volume ls -qf dangling=true)
```
#### logs container
```
docker logs -f container
```
#### stats container
```
docker stats container
```
### Pluie container
#### map
[db.docker](http://db.docker)
[pma.docker](http://pma.docker)
[gogs.docker](http://gogs.docker)
[bo-payment.docker](http://bo-payment.docker)
[wordpress.docker](http://wordpress.docker)
[fpm.docker](http://symfony.docker)
[symfony.docker](http://symfony.docker)
#### Mysql
```
cd /home/dev/docker
docker run --name mysql --restart=always \
--net home0 -h db.docker --ip 172.22.0.2 \
-v $(pwd)/db/mysql:/var/lib/mysql \
-v $(pwd)/db/dump:/dump \
-e MYSQL_DATABASE=bo-payment \
-e MYSQL_USER=dev \
-e MYSQL_PASSWORD=mysql \
-d pluie/alpine-mysql
```
#### Gogs
```
cd /home/dev/docker
docker run --name gogs --restart=always \
--net home0 -h gogs.docker --ip 172.22.0.3 --link mysql:db \
-v $(pwd)/gogs:/data \
gogs/gogs
```
#### Phpmyadmin
```
docker run --name pma --restart=always \
--net home0 -h pma.docker --ip 172.22.0.4 --link mysql:db \
-d phpmyadmin/phpmyadmin
```
#### Apache
```
cd /home/dev/docker
docker run --name apache --restart=always \
--net home0 -h bo-payment.docker --ip 172.22.0.5 --link mysql:db \
-v $(pwd)/repo/bo-payment:/app \
-e HTTP_SERVER_NAME=bo-payment.docker \
-d pluie/alpine-apache
```
#### Apache Php7
```
cd /home/dev/docker
docker run --name php7 --restart=always \
--net home0 -h bo-payment.docker --ip 172.22.0.9 --link mysql:db \
-v $(pwd)/repo/pws-server:/app \
-e HTTP_SERVER_NAME=bo-payment.docker \
-e WWW_DIR=web \
-d pluie/alpine-apache-php7
```
#### Wordpress
```
cd /home/dev/docker
docker run --name wordpress --restart=always \
--net home0 -h wordpress.docker --ip 172.22.0.6 --link mysql:db \
-v $(pwd)/repo/blog:/app \
-e HTTP_SERVER_NAME=wordpress.docker \
-d pluie/alpine-apache
```
#### ApacheFpm
```
cd /home/dev/docker
docker run --name afpm --restart=always \
--net home0 -h fpm.docker --ip 172.22.0.7 --link mysql:db \
-v $(pwd)/repo/afpm:/app \
-e HTTP_SERVER_NAME=afpm.docker \
-d pluie/alpine-apache-fpm
```
### Symfony
```
cd /home/dev/docker
docker run --name symfony --restart=always \
--net home0 -h symfony.docker --ip 172.22.0.8 --link=mysql:db \
-e HTTP_SERVER_NAME=symfony \
-e SYMFONY_VERSION=2.8 \
-v $(pwd)/repo/myapp:/app \
-d pluie/alpine-symfony
```
### Symfony Php7
```
cd /home/dev/docker
docker run --name symfony --restart=always \
--net home0 -h symfony.docker --ip 172.22.0.8 --link=mysql:db \
-e HTTP_SERVER_NAME=symfony \
-e SYMFONY_VERSION=3.2 \
-v $(pwd)/repo/myapp:/app \
-d pluie/alpine-symfony-php7
```
[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

View File

@ -1,12 +1,21 @@
# docker-images
based images for Docker
various based images for Docker
## Available Images
- __pluie/alpine__ ( < 10 MB) Alpine/3.2
- __pluie/alpine-apache__ ( ~ 37 MB) Apache/2.4.16 Php/5.6.21
- __pluie/alpine-mysql__ ( ~ 160 MB) Mysql/5.5.47 [MariaDB]
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
## Base Image Structure
@ -21,7 +30,7 @@ project/
|
|-- pre-init.d/ # deployed in /scripts on target container
| | # launch on docker container running process
| |-- 50-example.sh
| |-- 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
@ -67,3 +76,16 @@ __build__ script archive project files in __files.tar__ then execute the __Docke
no need to worry about pwd, docker repository and image name depends on directory structure.
you can keep same __build__ script in any project
[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

1
pluie/alpine-apache-fpm/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
files.tar

View File

@ -0,0 +1,22 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=ApacheFpm \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=fpm.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
VOLUME /etc/php5/fpm.d/
RUN bash /scripts/install.sh

View File

@ -0,0 +1,106 @@
# pluie/alpine-apache
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine with __apache 2.4.25__ and __php 5.6.30__ with FPM
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : fpm.docker ortherwise edit app/vhost later)
## Image Size
- image ~ 51 MB
## ENV variables
```
HTTP_SERVER_NAME=fpm.docker # apache ServerName
WWW_DIR=www # DocumentRoot relative to volume
WWW_INDEX=index.php # DirectoryIndex
FIX_OWNERSHIP=1 #
```
### Inherit ENV variables
```
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=ApacheFpm # container name
SHENV_COLOR=67 # ANSI EXTENDED COLOR CODE
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
pluie/alpine-apache-fpm has to volumes :
- __/app__ to bind to your app project (silex/symfony etc)
- __/etc/php5/fpm.d/__ to customize fpm
### note
__/app/$WWW_DIR__ is the documentRoot.
put only your entry point and static files to the documentRoot directory, no your app sources
(__/app__ directory is design for this).
__/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
```
/app/ # your application directory
|
|---- $WWW_DIR/ # documentRoot
|
|---- vhost # apache app vhost
```
## Image Usage
chdir to your project directory
```
$ docker run --name afpm -it --link=mysql:db -v $(pwd):/app pluie/alpine-apache-fpm
```
or
```
$ docker run --name afpm -d --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache-fpm
```
## Controling http server
```
# reload
$ docker exec -it afpm "httpd -k graceful"
# restart
$ docker exec -it afpm "httpd -k restart"
```
for more commands :
```
$ docker exec -it afpm "httpd -h"
```
[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/alpine-apache-fpm/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
"
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/"
cd $TMPPWD

Binary file not shown.

View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add apache2 apache2-proxy apache2-proxy-html apache-mod-fcgid libxml2 \
php5-fpm php5-cli php5-phar php5-zlib php5-zip php5-ctype php5-xml php5-pdo_mysql php5-mysqli \
php5-opcache php5-pdo php5-json php5-curl php5-gd php5-mcrypt php5-openssl php5-dom \
# php-pdo_odbc php-soap php-pgsql

View File

@ -0,0 +1,50 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
function a2setModule(){
local enable=${1:-''}
local path=${3:-'/etc/apache2/httpd.conf'}
local scom=''
local rcom='\#'
if [ ! -z $1 ] && [ ! -z "$2" ]; then
if [ "$enable" = 1 ]; then
scom='\#'
rcom=''
fi
echo "$2"
sed -i "s#${scom}LoadModule $2_module modules/mod_$2.so#${rcom}LoadModule $2_module modules/mod_$2.so#" "$path"
fi
}
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2
fi
chmod -R 755 /scripts/pre-init.d
mkdir -p /run/apache2
chown apache:apache /run/apache2
initTitle "Apache" "Loading Modules"
a2setModule 1 "rewrite"
a2setModule 1 "mpm_event"
a2setModule 1 "slotmem_shm"
a2setModule 1 "heartmonitor"
a2setModule 1 "watchdog"
initTitle "Apache" "Removing Modules"
a2setModule 0 "mpm_prefork"
a2setModule 0 "proxy_fdpass" /etc/apache2/conf.d/proxy.conf
echo
tmpsed="/etc/php5/php.ini"
sed -ir 's/expose_php = On/expose_php = Off/' $tmpsed
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
cat $tmpsed | grep "date.timezone"
sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" $tmpsed
tmpsed="/etc/php5/php-fpm.conf"
sed -i "s|;*daemonize\s*=\s*yes|daemonize = no|g" $tmpsed
sed -i "s|;*listen\s*=\s*127.0.0.1:9000|listen = 9000|g" $tmpsed
sed -i "s|;*listen\s*=\s*/||g" $tmpsed
sed -i "s|pm = dynamic|pm = ondemand|g" $tmpsed
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
unset tmpsed

12
pluie/alpine-apache-fpm/main.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
sleep 3 && \
initTitle "Starting" "Apache Daemon" && \
httpd
initTitle "Starting" "PHP-FPM"
/usr/bin/php-fpm &
tail -F /var/log/apache2/error.log

View File

@ -0,0 +1,19 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -d /app/$WWW_DIR ]; then
CREATE_WWW_DIR=1
mkdir -p /app/$WWW_DIR
fi
if [ ! -f /app/$WWW_DIR/$WWW_INDEX ]; then
echo "<?php phpinfo();" > /app/$WWW_DIR/$WWW_INDEX
fi
tmpsed=/etc/apache2/httpd.conf
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g' $tmpsed
sed -i 's#AllowOverride none#AllowOverride All#' $tmpsed
if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ] && [ -d /app/$WWW_DIR ]; then
chown -R 1000:apache /app/$WWW_DIR
fi
touch /var/log/apache2/error.log

View File

@ -0,0 +1,27 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "/app/vhost" ]; then
cat <<EOF > "/app/vhost"
<VirtualHost *:80>
ServerName $HTTP_SERVER_NAME
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=\$1
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
<Directory /app/$WWW_DIR>
AllowOverride None
Require all granted
DirectoryIndex $WWW_INDEX
<IfModule mod_rewrite.c>
Options -MultiViews +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ $WWW_INDEX [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
# IncludeOptional /app/vhost2
EOF
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
tmpsed="/etc/php5/php.ini"
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
cat $tmpsed | grep "date.timezone"

View File

@ -0,0 +1,20 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=Php7 \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=php7.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
RUN bash /scripts/install.sh

View File

@ -0,0 +1,102 @@
# pluie/alpine-apache-php7
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine with __apache 2.4.25__ and __php 7.0.16__
- error log are attached to stdout
- no need port redirection
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : site.docker ortherwise edit /app/vhost later)
- you can still use ever your local http & sql server while your container(s) are running
## Image Size
- image ~ 45 MB
## ENV variables
```
HTTP_SERVER_NAME=site.docker # apache ServerName
WWW_DIR=www # DocumentRoot relative to volume
WWW_INDEX=index.php # DirectoryIndex
FIX_OWNERSHIP=1 #
```
### Inherit ENV variables
```
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=Php7 # container name
SHENV_COLOR=67 # ANSI EXTENDED COLOR CODE
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
__/app__ directory is a docker volume bind to your app project (silex/symfony etc)
__/app/$WWW_DIR__ is the documentRoot.
put only your entry point and static files to the documentRoot directory, no your app sources
(__/app__ directory is design for this).
__/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
```
/app/ # your application directory
|
|---- $WWW_DIR/ # documentRoot
|
|---- vhost # apache app vhost
```
## Image Usage
chdir to your project directory
```
$ docker run --name php7 -it --link=mysql:db -v $(pwd):/app pluie/alpine-apache
```
or
```
$ docker run --name php7 -it --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache-php7
```
## Controling http server
```
# reload
$ docker exec -it php7 "httpd -k graceful"
# restart
$ docker exec -it php7 "httpd -k restart"
```
for more commands :
```
$ docker exec -it php7 "httpd -h"
```
[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/alpine-apache-php7/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
"
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/"
cd $TMPPWD

Binary file not shown.

View File

@ -0,0 +1,15 @@
#!/bin/bash
# @app pluie/alpine-apache-php7
# @author a-Sansara https://git.pluie.org/pluie/docker-images
#~ echo "http://dl-cdn.alpinelinux.org/alpine/edge/community
#~ http://dl-cdn.alpinelinux.org/alpine/edge/main
#~ http://dl-cdn.alpinelinux.org/alpine/edge/testing
#~ echo "http://alpine.gliderlabs.com/alpine/edge/community
#~ http://alpine.gliderlabs.com/alpine/edge/main
#~ http://alpine.gliderlabs.com/alpine/edge/testing
#~ " >> /etc/apk/repositories
#~ echo "http://dl-5.alpinelinux.org/alpine/edge/community
#~ http://dl-5.alpinelinux.org/alpine/edge/main
#~ http://dl-5.alpinelinux.org/alpine/edge/testing
#~ " > /etc/apk/repositories

View File

@ -0,0 +1,9 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add apache2 apache2-proxy \
php7-apache2 php7-mbstring php7-session php7-phar php7-zlib php7-zip php7-ctype \
php7-mysqli php7-xml php7-pdo_mysql php7-opcache php7-pdo php7-json php7-curl \
php7-gd php7-mcrypt php7-openssl php7-dom \
# php-pdo_odbc php-soap php-pgsql

View File

@ -0,0 +1,46 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
function a2setModule(){
local enable=${1:-''}
local path=${3:-'/etc/apache2/httpd.conf'}
local scom=''
local rcom='\#'
if [ ! -z $1 ] && [ ! -z "$2" ]; then
if [ "$enable" = 1 ]; then
scom='\#'
rcom=''
fi
echo "$2"
sed -i "s#${scom}LoadModule $2_module modules/mod_$2.so#${rcom}LoadModule $2_module modules/mod_$2.so#" "$path"
fi
}
if [ ! -f /usr/bin/php ]; then
ln -s /usr/bin/php7 /usr/bin/php
fi
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2
fi
chmod -R 755 /scripts/pre-init.d
mkdir -p /run/apache2
chown apache:apache /run/apache2
initTitle "Apache" "Loading Modules"
a2setModule 1 "rewrite"
a2setModule 1 "mpm_prefork"
a2setModule 1 "slotmem_shm"
a2setModule 1 "heartmonitor"
#~ a2setModule 1 "watchdog"
initTitle "Apache" "Removing Modules"
a2setModule 0 "mpm_event"
a2setModule 0 "proxy_fdpass" /etc/apache2/conf.d/proxy.conf
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" /etc/php7/php.ini
sed -ir 's/expose_php = On/expose_php = Off/' /etc/php7/php.ini
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
unset tmpsed

View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
initTitle "Starting" "Apache Daemon"
httpd -D FOREGROUND

View File

@ -0,0 +1,23 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -d /app/$WWW_DIR ]; then
echo create dir mode
CREATE_WWW_DIR=1
mkdir -p /app/$WWW_DIR
fi
if [ ! -f /app/$WWW_DIR/$WWW_INDEX ]; then
echo "<?php phpinfo();" > /app/$WWW_DIR/$WWW_INDEX
fi
tmpsed='s#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g'
sed -i "$tmpsed" /etc/apache2/httpd.conf
sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf
if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ] && [ -d /app/$WWW_DIR ]; then
chown -R 1000:apache /app/$WWW_DIR
fi
touch /var/log/apache2/error.log
tail -F /var/log/apache2/error.log &

View File

@ -0,0 +1,24 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "/app/vhost" ]; then
cat <<EOF > "/app/vhost"
<VirtualHost *:80>
ServerName $HTTP_SERVER_NAME
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=\$1
<Directory /app/$WWW_DIR>
AllowOverride None
Require all granted
DirectoryIndex $WWW_INDEX
<IfModule mod_rewrite.c>
Options -MultiViews +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ $WWW_INDEX [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
# IncludeOptional /app/vhost2
EOF
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
tmpsed="/etc/php7/php.ini"
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
cat $tmpsed | grep "date.timezone"

View File

@ -1,13 +1,20 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine
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
ENV SHENV_NAME=Apache \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=site.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
VOLUME /app
RUN bash /scripts/install.sh

View File

@ -1,35 +1,65 @@
# pluie/alpine-apache
Extend pluie/alpine with apache 2.4.16
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine with __apache 2.4.25__ and __php 5.6.30__
- error log are attached to stdout
- no need port redirection
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : docker-site.dev ortherwise edit app/vhost later)
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : apache.docker ortherwise edit app/vhost later)
- you can still use ever your local http & sql server while your container(s) are running
## Image Size
- image ~ 37 MB
- image ~ 50 MB
## ENV variables
```
HTTP_SERVER_NAME=apache.docker # apache ServerName
WWW_DIR=www # DocumentRoot relative to volume
WWW_INDEX=index.php # DirectoryIndex
FIX_OWNERSHIP=1 #
```
### Inherit ENV variables
```
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=Apache # container name
SHENV_COLOR=67 # ANSI EXTENDED COLOR CODE
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
__/app__ directory is a docker volume bind to your app project (silex/symfony etc)
__/app/www/__ is the documentRoot.
__/app/$WWW_DIR__ is the documentRoot.
put only your entry point and static files to the documentRoot directory, no your app sources
(__/app__ directory is design for this).
__/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to the unique entry point index.php
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
```
/app/ # your application directory
/app/ # your application directory
|
|---- www/ # documentRoot
|---- $WWW_DIR/ # documentRoot
|
|---- vhost # apache app vhost
|---- vhost # apache app vhost
```
@ -37,20 +67,36 @@ by default it use the apache rewrite module to redirect all uri to the unique en
chdir to your project directory
```
$ docker run --name apache -it --link=db1:mysql -v $(pwd):/app pluie/apache
$ docker run --name apache -it --link=mysql:db -v $(pwd):/app pluie/alpine-apache
```
or
```
$ docker run --name srv -it --link=db1:mysql -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/apache
$ docker run --name apache -it --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache
```
## Controling http server
```
# reload
$ docker exec -it apache "httpd -k graceful"
# restart
$ docker exec -it apache "httpd -k restart"
```
for more commands :
```
$ docker exec -it apache "httpd -h"
```
[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

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @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"
@ -13,7 +14,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,7 +1,8 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk --update add apache2 \
php-apache2 php-cli php-phar php-zlib php-zip php-ctype php-mysqli php-pdo_mysql php-xml \
php-opcache php-pdo php-json php-curl php-gd php-mcrypt php-openssl \
apk add apache2 apache2-proxy \
php5-apache2 php5-cli php5-phar php5-zlib php5-zip php5-ctype php5-mysqli php5-xml php5-pdo_mysql \
php5-opcache php5-pdo php5-json php5-curl php5-gd php5-mcrypt php5-openssl php5-dom \
# php-pdo_odbc php-soap php-pgsql

View File

@ -1,11 +1,43 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
function a2setModule(){
local enable=${1:-''}
local path=${3:-'/etc/apache2/httpd.conf'}
local scom=''
local rcom='\#'
if [ ! -z $1 ] && [ ! -z "$2" ]; then
if [ "$enable" = 1 ]; then
scom='\#'
rcom=''
fi
echo "$2"
sed -i "s#${scom}LoadModule $2_module modules/mod_$2.so#${rcom}LoadModule $2_module modules/mod_$2.so#" "$path"
fi
}
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2
fi
mkdir -p /app/www
chown -R 1000:apache /app/www
chmod -R 755 /scripts/pre-init.d
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/www"#g' /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
mkdir -p /run/apache2
chown apache:apache /run/apache2
initTitle "Apache" "Loading Modules"
a2setModule 1 "rewrite"
a2setModule 1 "mpm_prefork"
a2setModule 1 "slotmem_shm"
a2setModule 1 "heartmonitor"
a2setModule 1 "watchdog"
initTitle "Apache" "Removing Modules"
a2setModule 0 "mpm_event"
a2setModule 0 "proxy_fdpass" /etc/apache2/conf.d/proxy.conf
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" /etc/php5/php.ini
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
unset tmpsed

View File

@ -1,7 +1,8 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
echo "[[ Starting Apache Daemon ]]"
initTitle "Starting" "Apache Daemon"
httpd -D FOREGROUND

View File

@ -1,8 +1,20 @@
#!/usr/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ]; then
chown -R 1000:apache /app/www
if [ ! -d /app/$WWW_DIR ]; then
CREATE_WWW_DIR=1
mkdir -p /app/$WWW_DIR
fi
if [ ! -f /app/$WWW_DIR/$WWW_INDEX ]; then
echo "<?php phpinfo();" > /app/$WWW_DIR/$WWW_INDEX
fi
tmpsed=/etc/apache2/httpd.conf
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g' "$tmpsed"
sed -i 's#AllowOverride none#AllowOverride All#' "$tmpsed"
if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ] && [ -d /app/$WWW_DIR ]; then
chown -R 1000:apache /app/$WWW_DIR
fi
touch /var/log/apache2/error.log

View File

@ -1,19 +1,21 @@
#!/usr/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "/app/vhost" ]; then
cat <<EOF > "/app/vhost"
<VirtualHost *:80>
ServerName $HTTP_SERVER_NAME
<Directory /app/www>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=\$1
<Directory /app/$WWW_DIR>
AllowOverride None
Allow from all
DirectoryIndex index.php
Require all granted
DirectoryIndex $WWW_INDEX
<IfModule mod_rewrite.c>
Options -MultiViews +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
RewriteRule ^ $WWW_INDEX [QSA,L]
</IfModule>
</Directory>
</VirtualHost>

View File

@ -0,0 +1,4 @@
#!/bin/bash
tmpsed="/etc/php5/php.ini"
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
cat $tmpsed | grep "date.timezone"

View File

@ -0,0 +1,20 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=Php7 \
SHENV_COLOR=67 \
HTTP_SERVER_NAME=php7.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
RUN bash /scripts/install.sh

View File

@ -0,0 +1,102 @@
# pluie/alpine-apache-php7
- [index][1]
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
- [pluie/alpine-apache-fpm][7] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24 Fpm
- [pluie/alpine-symfony][6] ( ~ 82 MB ) Symfony2.8 or 3.1
- [pluie/alpine-apache-php7][8] ( ~ 50 MB ) Apache/2.4.25 Php/7.0.15
- [pluie/alpine-symfony-php7][9] ( ~ 82 MB ) Symfony2.8 or 3.2 Php/7.0.15
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
- [pluie/libecho][10] ( ~288 MB ) Vala 0.34.2 pluie-echo-0.2
- [pluie/ubuntu][12] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine with __apache 2.4.25__ and __php 7.0.15__
- error log are attached to stdout
- no need port redirection
- you can use env var at container creation : __HTTP_SERVER_NAME__ (default : site.docker ortherwise edit /app/vhost later)
- you can still use ever your local http & sql server while your container(s) are running
## Image Size
- image ~ 50 MB
## ENV variables
```
HTTP_SERVER_NAME=site.docker # apache ServerName
WWW_DIR=www # DocumentRoot relative to volume
WWW_INDEX=index.php # DirectoryIndex
FIX_OWNERSHIP=1 #
```
### Inherit ENV variables
```
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=Php7 # container name
SHENV_COLOR=67 # ANSI EXTENDED COLOR CODE
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
__/app__ directory is a docker volume bind to your app project (silex/symfony etc)
__/app/$WWW_DIR__ is the documentRoot.
put only your entry point and static files to the documentRoot directory, no your app sources
(__/app__ directory is design for this).
__/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
```
/app/ # your application directory
|
|---- $WWW_DIR/ # documentRoot
|
|---- vhost # apache app vhost
```
## Image Usage
chdir to your project directory
```
$ docker run --name php7 -it --link=mysql:db -v $(pwd):/app pluie/alpine-apache
```
or
```
$ docker run --name php7 -it --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-apache-php7
```
## Controling http server
```
# reload
$ docker exec -it php7 "httpd -k graceful"
# restart
$ docker exec -it php7 "httpd -k restart"
```
for more commands :
```
$ docker exec -it php7 "httpd -h"
```
[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/alpine-fpm-php7/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
"
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/"
cd $TMPPWD

Binary file not shown.

View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/alpine-apache-php7
# @author a-Sansara https://git.pluie.org/pluie/docker-images
#
#~ echo "http://dl-5.alpinelinux.org/alpine/edge/community
#~ http://dl-5.alpinelinux.org/alpine/edge/main
#~ http://dl-5.alpinelinux.org/alpine/edge/testing
#~ " > /etc/apk/repositories

View File

@ -0,0 +1,9 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add apache2 apache2-proxy apache2-proxy-html apache-mod-fcgid php7-fpm \
php7-apache2 php7-mbstring php7-session php7-phar php7-zlib php7-zip php7-ctype \
php7-mysqli php7-xml php7-pdo_mysql php7-opcache php7-pdo php7-json php7-curl \
php7-gd php7-mcrypt php7-openssl php7-dom \
# php-pdo_odbc php-soap php-pgsql

View File

@ -0,0 +1,60 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
function a2setModule(){
local enable=${1:-''}
local path=${3:-'/etc/apache2/httpd.conf'}
local scom=''
local rcom='\#'
if [ ! -z $1 ] && [ ! -z "$2" ]; then
if [ "$enable" = 1 ]; then
scom='\#'
rcom=''
fi
echo "$2"
sed -i "s#${scom}LoadModule $2_module modules/mod_$2.so#${rcom}LoadModule $2_module modules/mod_$2.so#" "$path"
fi
}
if [ ! -f /usr/bin/php ]; then
ln -s /usr/bin/php7 /usr/bin/php
fi
if [ ! -f /usr/lib/libxml2.so ]; then
ln -s /usr/lib/libxml2.so.2 /usr/lib/libxml2.so
fi
if [ ! -d /app/$WWW_DIR ]; then
mkdir -p /app/$WWW_DIR
fi
if [ ! -d /run/apache2 ]; then
mkdir /run/apache2
fi
chown -R 1000:apache /app/$WWW_DIR
chmod -R 755 /scripts/pre-init.d
mkdir -p /run/apache2
chown apache:apache /run/apache2
tmpsed='s#^DocumentRoot ".*#DocumentRoot "/app/'$WWW_DIR'"#g'
sed -i "$tmpsed" /etc/apache2/httpd.conf
sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf
initTitle "Apache" "Loading Modules"
a2setModule 1 "rewrite"
a2setModule 1 "mpm_event"
a2setModule 1 "slotmem_shm"
a2setModule 1 "heartmonitor"
a2setModule 1 "watchdog"
initTitle "Apache" "Removing Modules"
a2setModule 0 "mpm_prefork"
a2setModule 0 "proxy_fdpass" /etc/apache2/conf.d/proxy.conf
echo
tmpsed="/etc/php7/php.ini"
sed -ir 's/expose_php = On/expose_php = Off/' $tmpsed
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" $tmpsed
tmpsed="/etc/php7/php-fpm.conf"
sed -i "s|;*daemonize\s*=\s*yes|daemonize = no|g" $tmpsed
sed -i "s|;*listen\s*=\s*127.0.0.1:9000|listen = 9000|g" $tmpsed
sed -i "s|;*listen\s*=\s*/||g" $tmpsed
sed -i "s|pm = dynamic|pm = ondemand|g" $tmpsed
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
unset tmpsed

8
pluie/alpine-fpm-php7/main.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
initTitle "Starting" "Apache Daemon"
httpd -D FOREGROUND

View File

@ -0,0 +1,11 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "$FIX_OWNERSHIP" ] && [ "$FIX_OWNERSHIP" -eq 1 ] && [ -d /app/$WWW_DIR ]; then
chown -R 1000:apache /app/$WWW_DIR
fi
touch /var/log/apache2/error.log
tail -F /var/log/apache2/error.log &

View File

@ -0,0 +1,27 @@
#!/usr/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "/app/vhost" ]; then
cat <<EOF > "/app/vhost"
<VirtualHost *:80>
ServerName $HTTP_SERVER_NAME
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
<Directory /app/$WWW_DIR>
AllowOverride None
Require all granted
DirectoryIndex $WWW_INDEX
<IfModule mod_rewrite.c>
Options -MultiViews +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ $WWW_INDEX [QSA,L]
</IfModule>
</Directory>
</VirtualHost>
# IncludeOptional /app/vhost2
EOF
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
tmpsed="/etc/php7/php.ini"
sed -i "s|;*date.timezone =.*|date.timezone = ${TZ}|i" $tmpsed
cat $tmpsed | grep "date.timezone"

View File

@ -4,10 +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
ENV SHENV_NAME=Mysql \
SHENV_COLOR=132
EXPOSE 3306
VOLUME ["/var/lib/mysql", "/dump"]
RUN bash /scripts/install.sh

View File

@ -1,64 +1,146 @@
# pluie/alpine-mysql
Extend pluie/alpine with mysql (mariadb) 5.5.47
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine with mysql (MariaDb/10.1.22)
Project comes with various scripts to execute basic tasks such as :
- dbcreate
- dbdump
- dbload
If database directory is empty a root user is created at startup.
Root access to database is only permit on localhost
## Image Size
- image ~ 160 MB
- image ~ 181 MB
## Image Volumes
__/var/lib/mysql__ : mysql database directory
__/dump__ : directory to store various mysql scripts
```
/var/lib/mysql # mysql database directory
/dump # directory to store various mysql scripts
```
## ENV variables
__MYSQL_DATABASE__ : create specified database at startup
__MYSQL_USER__ : create specified user at startup (and grant all rights to __MYSQL_DATABASE__)
__MYSQL_PASSWORD__
__MYSQL_ROOT_PASSWORD__ : don't really need it. a random root password is generated if none
```
MYSQL_DATABASE # create specified database at startup
MYSQL_USER # create specified user at startup (and grant all rights to MYSQL_DATABASE)
MYSQL_PASSWORD
MYSQL_ROOT_PASSWORD # don't really need it. a random root password is generated if none
```
### Inherit ENV variables
```
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=Mysql # container name
SHENV_COLOR=97 # ANSI EXTENDED COLOR CODE
```
## Image Usage
for example to start a new project :
```
$ docker run --name mysql -p 3306 -v /home/docker/db/mysql:/var/lib/mysql -v /home/docker/db/dump:/dump -e MYSQL_DATABASE=mybase -e MYSQL_USER=dev -e MYSQL_PASSWORD=mysql -it pluie/alpine-mysqldocker
$ cd /home/docker;
$ mkdir -p db/{mysql,dump}
$ docker run --name mysql \
-v $(pwd)/db/mysql:/var/lib/mysql \
-v $(pwd)/db/dump:/dump \
-e MYSQL_DATABASE=mybase \
-e MYSQL_USER=dev \
-e MYSQL_PASSWORD=mysql \
-it pluie/alpine-mysql
```
you don't need to expose your localhost mysql port.
for example :
```
$ docker run --name pma -p 8080:80 --link mysql:db -d phpmyadmin/phpmyadmin
```
### Root Usage
and __phpmyadmin__ is accessible via `http://localhost:8080/` and linked to your mysql container
(by the way on dev, you don't need to expose your 8080 port too... simply use a bridge network and update your
`/etc/hosts` file - see [ docker tips ][5] for that)
a root user is created at startup (if database directory is empty)
root login is permit only on localhost
to do things without files you can run :
### Existing Scripts
create a new database with full rights to a user :
```
$ docker exec -it mysql "mysql -uroot"
$ docker exec -it mysql /dbcreate mydbname myuser
```
to do things with files you can log in to container :
load an export file in particular database :
```
$ docker exec -it mysql /dbload mydbname /dump/mydbname.init.sql
```
dump a database :
```
$ docker exec -it mysql /dbdump mydbname
```
### More specific actions as user
to connect to the mysql server as user from host :
```
mysql -h ipmysqlcontainer -udev -pmysql
```
to retriew container ip you can run first :
```
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql
```
to connect to the mysql server as user from container :
```
$ docker exec -it mysql "mysql -udev -pmysql"
```
### More specific actions as root
to connect to the mysql server as root :
```
$ docker exec -it mysql mysql
```
to connect to the mysql container as root :
```
docker exec -it mysql bash
```
then
```
$ mysql -uroot mybase < /dump/mydump.sql
$ mysql -uroot mybase < /dump/init.mybase.sql
$ mysqldump -uroot mybase > /dump/last.mybase.dump.sql
```
etc.
etc.
### User usage
locally (on host) you can run (with appropriate user : pass) :
```
mysql -h ipmysqlcontainer -udev -pmysql
```
or if you want use the mysql client of the container :
```
docker exec -it mysql "mysql -h ipmysqlcontainer -udev -pmysql"
```
## Link Container
to link this container to another, use the default docker behavior :
to link this container to another, use the default docker behavior
(as the example provide with phpmyadmin) :
```
docker run --name mycontainer --link mysql:db ...
```
[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

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-mysql
# @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"
@ -13,7 +14,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
"

View File

@ -0,0 +1,36 @@
#!/bin/bash
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
Ctitle="\033[1;48;5;30;1;38;5;15m"
Ctext="\033[1;38;5;30m"
Copt="\033[1;38;5;72m"
Cspe="\033[1;38;5;30m"
Cerr="\033[1;38;5;196m"
Cusa="\033[1;38;5;214m"
Coff="\033[m"
function echoTitle(){
echo -e "\n ${Ctitle} $shname ${Coff}"
}
function mktfile(){
tfile="$(mktemp)"
if [ ! -f "$tfile" ]; then
echoErr "can't make temp file" 1
exit 1
fi
}
function errEmptyDb(){
echoErr "database can't be empty"
}
function echoErr(){
echo -e "\n${Cerr} error : $1${Coff}"
if [ -z "$2" ]; then
usage
fi
echo
exit 1
}

43
pluie/alpine-mysql/dbcreate.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/dbcommon.sh
dbname=${1:-''}
dbuser=${2:-''}
shname=$(basename $0)
echoTitle
function usage(){
echo -e "\n ${Cusa}usage :${Coff}\n ${Ctext}$shname \t${Copt}DBNAME ${Cspe}[${Copt}USER${Cspe}]${Coff}"
}
mktfile
if [ ! -z "$dbname" ]; then
cat <<EOF > "$tfile"
CREATE DATABASE IF NOT EXISTS \`$dbname\` CHARACTER SET utf8 COLLATE utf8_general_ci;
EOF
if [ ! -z "$dbuser" ]; then
cat <<EOF >> "$tfile"
GRANT ALL ON \`$dbname\`.* to '$dbuser'@'localhost';
GRANT ALL ON \`$dbname\`.* to '$dbuser'@'%';
EOF
fi
echo "FLUSH PRIVILEGES;" >> "$tfile"
echo
cat "$tfile" | sed "s/^/ /";
echo
mysql -uroot < "$tfile"
if [ $? -eq 0 ]; then
echo -e "\n done"
fi
echo
rm -f "$tfile"
else
errEmptyDb
fi

23
pluie/alpine-mysql/dbdump.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
. /scripts/dbcommon.sh
dbname=${1:-''}
shname=$(basename $0)
echoTitle
function usage(){
echo -e "\n ${Cusa}usage :${Coff}\n ${Ctext}$shname \t${Copt}DBNAME USER${Coff}"
}
if [ ! -z "$1" ]; then
mysqldump -uroot "$dbname" > "/dump/"$(date +"%y%m%d-%H%I")".$dbname.sql"
if [ $? -eq 0 ]; then
echo -e "\n done"
fi
echo
else
errEmptyDb
fi

29
pluie/alpine-mysql/dbload.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/dbcommon.sh
dbname=${1:-''}
filename=${2}
shname=$(basename $0)
echoTitle
function usage(){
echo -e "\n ${Cusa}usage :${Coff}\n ${Ctext}$shname \t${Copt}DBNAME FILENAME${Coff}"
}
if [ ! -f "$filename" ]; then
echoErr "unknow file '$filename'"
fi
if [ ! -z "$1" ]; then
mysql -uroot "$dbname" < "$filename"
if [ $? -eq 0 ]; then
echo -e "\n done"
fi
echo
else
errEmptyDb
fi

Binary file not shown.

View File

@ -1,4 +1,5 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk --update add mysql mysql-client pwgen \
apk add mysql mysql-client pwgen \

View File

@ -1,2 +0,0 @@
chown -R root:root /scripts/
rm -f /scripts/pre-init.d/50-example.sh

View File

@ -0,0 +1,7 @@
#!/bin/bash
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
mv /scripts/dbdump.sh /dbdump
mv /scripts/dbcreate.sh /dbcreate
mv /scripts/dbload.sh /dbload

View File

@ -1,7 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
echo "[[ Starting Mysql Daemon ]]"
exec /usr/bin/mysqld --user=mysql --console

View File

@ -1,5 +1,18 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine-mysql
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/util.sh
function mysql.secure(){
chown mysql:mysql $1
sleep 5
initTitle "SECURING" "DATABASE"
echo "please wait."
sleep 5
rm -f $1
echo "done"
}
if [ ! -d "/run/mysqld" ]; then
mkdir -p /run/mysqld
@ -7,9 +20,10 @@ if [ ! -d "/run/mysqld" ]; then
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 > /dev/null
mysql_install_db --user=mysql --verbose=1 --basedir=/usr --datadir=/var/lib/mysql --rpm > /dev/null
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
MYSQL_ROOT_PASSWORD=`pwgen -y -s 18 1`
@ -24,20 +38,19 @@ if [ ! -d /var/lib/mysql/mysql ]; then
return 1
fi
cat << EOF > $tfile
USE mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
UPDATE user SET password=PASSWORD("$MYSQL_ROOT_PASSWORD") WHERE user='root';
cat <<-EOF > $tfile
UPDATE mysql.user SET password=PASSWORD('$MYSQL_ROOT_PASSWORD') WHERE user='root';
DELETE FROM mysql.user WHERE user='root' AND host NOT IN ('localhost', '127.0.0.1', '::1', '$(hostname)');
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;
UPDATE user SET password=PASSWORD("") WHERE user='root' AND host='localhost';
UPDATE mysql.user SET password=PASSWORD("") WHERE user='root' AND host='localhost';
EOF
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
fi
if [ "$MYSQL_USER" != "" ] && [ "$MYSQL_USER" != 'root' ]; then
echo "[[ CREATE USER $MYSQL_USER ]]";
echo "
CREATE USER '$MYSQL_USER'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';
CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile
@ -47,6 +60,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
fi
fi
/usr/bin/mysqld --user=mysql --bootstrap --skip-grant-tables=0 --verbose=0 < $tfile
rm -f $tfile
echo "FLUSH PRIVILEGES;" >> $tfile
mysql.secure $tfile &
initTitle "Starting" "Mysql Daemon"
exec /usr/bin/mysqld --user=mysql --console --init-file="$tfile"
else
initTitle "Skipping" "DB init"
initTitle "Starting" "Mysql Daemon"
fi

1
pluie/alpine-symfony-php7/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
files.tar

View File

@ -0,0 +1,19 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine-apache-php7
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=Symfony \
SHENV_COLOR=33 \
HTTP_SERVER_NAME=symfony.docker \
WWW_DIR=web \
WWW_INDEX=app.php \
SYMFONY_VERSION=3.2
EXPOSE 80
RUN bash /scripts/install.sh

View File

@ -0,0 +1,88 @@
# pluie/alpine-symfony-php7
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine-apache-php7.
if __/app/$WWW_DIR__ does not exits then __pluie/alpine-symfony-php7__ install
the symfony framework with $SYMFONY_VERSION version on the /app directory
## Image Size
- image ~ 77 MB
## ENV variables
```
SYMFONY_VERSION=3.2 # symfony version
```
### Inherit ENV variables
```
HTTP_SERVER_NAME=symfony.docker # apache ServerName
WWW_DIR=web # DocumentRoot relative to volume
WWW_INDEX=app.php # DirectoryIndex
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=symfony # container name
SHENV_COLOR=33 # ANSI EXTENDED COLOR CODE
FIX_OWNERSHIP=1
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
- __/app__ directory is a docker volume bind to your symfony project
__/app/$WWW_DIR__ is the documentRoot.
__/app/vhost__ is your app vhost configuration file (with a serverName directive).
by default it use the apache rewrite module to redirect all uri to entry point $WWW_INDEX
## Image Usage
chdir to your project directory
```
$ docker run --name symfony -it --link=mysql:db -v $(pwd):/app pluie/alpine-symfony-php7
```
or
```
$ docker run --name symfony -d --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-symfony-php7
```
## Connect to container
```
$ docker exec -it symfony bash
```
## Run the console
```
$ docker exec -it symfony php /app/bin/console --ansi
```
[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/alpine-symfony-php7/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
"
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/"
cd $TMPPWD

Binary file not shown.

View File

@ -0,0 +1,7 @@
#!/bin/bash
# @app pluie/alpine-symfony
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add php7-iconv php7-intl php7-posix
curl -LsS https://symfony.com/installer -o /usr/bin/symfony
chmod +x /usr/bin/symfony

View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
initTitle "Starting" "Apache Daemon"
httpd -D FOREGROUND

View File

@ -0,0 +1,15 @@
#!/bin/bash
# @app pluie/alpine-symfony
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "$CREATE_WWW_DIR" ]; then
cd /tmp
symfony new app $SYMFONY_VERSION
rm -rf /app/web
mv -f app/* /app/
chown -R 1000:apache /app/
chown -R 774:apache /app/var
chmod -R g+w /app
CTN_IP=$(ip route | cut -d ' ' -f3 | head -n1)
sed -i "/::1/s//::1', '$CTN_IP/" /app/web/app_dev.php
fi

View File

@ -0,0 +1,19 @@
# @app pluie/alpine-symfony
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine-apache-fpm
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=Symfony \
SHENV_COLOR=33 \
HTTP_SERVER_NAME=symfony.docker \
WWW_DIR=web \
WWW_INDEX=app.php \
SYMFONY_VERSION=3.2
EXPOSE 80
RUN bash /scripts/install.sh

View File

@ -0,0 +1,84 @@
# pluie/alpine-symfony
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
Extend pluie/alpine-apache-fpm.
if __/app/$WWW_DIR__ does not exits then __pluie/alpine-symfony__ install
the symfony framework with `$SYMFONY_VERSION` version on the `/app` directory
## Image Size
- image ~ 83 MB
## ENV variables
```
SYMFONY_VERSION=3.1 # symfony version
```
### Inherit ENV variables
```
HTTP_SERVER_NAME=symfony.docker # apache ServerName
WWW_DIR=web # DocumentRoot relative to volume
WWW_INDEX=app.php # DirectoryIndex
SHENV_CTX=LOCAL # LOCAL|INT|PROD change context bg color
SHENV_NAME=symfony # container name
SHENV_COLOR=33 # ANSI EXTENDED COLOR CODE
FIX_OWNERSHIP=1
TZ=Europe/Paris # TIMEZONE
```
## Image Volumes
- __/app__ directory is a docker volume bind to your symfony project
- __/etc/php5/fpm.d/__ to customize fpm
## Image Usage
chdir to your project directory
```
$ docker run --name symfony -it --link=mysql:db -v $(pwd):/app pluie/alpine-symfony
```
or
```
$ docker run --name symfony -d --link=mysql:db -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-symfony
```
## Connect to container
```
$ docker exec -it symfony bash
```
## Run the console
```
$ docker exec -it symfony php /app/bin/console --ansi
```
[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/alpine-symfony/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
"
docker build --force-rm -t ${DOCKREPO}/${DOCKBUILD}:${DOCKTAG} . | sed "s/^/${indent}/"
cd $TMPPWD

Binary file not shown.

View File

@ -0,0 +1,7 @@
#!/bin/bash
# @app pluie/alpine-symfony
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add php5-iconv php5-intl php5-posix
curl -LsS https://symfony.com/installer -o /usr/bin/symfony
chmod +x /usr/bin/symfony

View File

@ -0,0 +1,15 @@
#!/bin/bash
# @app pluie/alpine-symfony
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -z "$CREATE_WWW_DIR" ]; then
cd /tmp
symfony new app $SYMFONY_VERSION
rm -rf /app/web
mv -f app/* /app/
chown -R 1000:apache /app/
chmod -R 777 /app/var
chmod -R g+w /app
CTN_IP=$(ip route | cut -d ' ' -f3 | head -n1)
sed -i "/::1/s//::1', '$CTN_IP/" /app/web/app_dev.php
fi

View File

@ -1,11 +1,20 @@
FROM gliderlabs/alpine:3.2
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM alpine:3.5
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV TERM=xterm \
SHENV_CTX=LOCAL \
SHENV_NAME=Alpine \
SHENV_COLOR=97 \
TZ=Europe/Paris
VOLUME /app
RUN apk --update add bash && bash /scripts/install.sh
ENV TERM=xterm SHENV_CTX=LOCAL SHENV_NAME=Alpine SHENV_COLOR=97
ENTRYPOINT ["/scripts/main.sh"]

View File

@ -1,18 +1,36 @@
# 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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
This Image provide a Linux Alpine distribution with :
- fully functionnal & colorized terminal
- bash
- curl
- nano as editor
Base image : [gliderlabs/alpine:3.2] (https://registry.hub.docker.com/u/gliderlabs/alpine/)
Base image : [alpine:3.5](https://hub.docker.com/_/alpine/)
This project come with a structure to facilitate further images (like pluie/alpine-apache & pluie/alpine-mysql)
__note :__ wget ssl issue
apk add ca-certificates wget && update-ca-certificates
## Image Size
- very small image < 10 MB
- very small image ~ 9 MB
## Image Usage
@ -34,7 +52,7 @@ project/
|
|-- pre-init.d/ # deployed in /scripts on target container
| | # launch on docker container running process
| |-- 50-example.sh
| |-- 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
@ -44,13 +62,13 @@ project/
```
you can easily create your own images based on this structure.
keep an eye to pluie/alpine-apache & pluie/alpine-mysql wich extend pluie/alpine
keep an eye to pluie/alpine-apache, pluie/alpine-apache-php7 & pluie/alpine-mysql wich extend pluie/alpine
## Extend pluie/alpine Image
RUN instructions are minimized
on extended image you can only use :
on extended image you only need to use :
```
RUN bash /scripts/install.sh
```
@ -72,12 +90,28 @@ 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=site.docker \
WWW_DIR=www \
WWW_INDEX=index.php \
FIX_OWNERSHIP=1 \
TZ=Europe/Paris
EXPOSE 80
VOLUME /app
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

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @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"
@ -13,7 +14,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
"

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/util.sh

Binary file not shown.

View File

@ -1,3 +1,5 @@
#!/bin/bash
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk --update add nano curl
apk --update add nano curl tzdata

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
if [ ! -f /root/.bash_ps1 ]; then
cat <<EOF >> /root/.bashrc

View File

@ -0,0 +1,16 @@
#!/bin/bash
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
#
# Keyboard shortcut : Ctrl+x followed by desired key
# refresh without bash logout : bind -f ~/.inputrc
cat <<EOF > /etc/inputrc
"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left
"\e[1~": beginning-of-line # home
"\e[3~": delete-char # delete
"\e[4~": end-of-line # end
"\e[5~": history-search-backward # page-up
"\e[6~": history-search-forward # page-down
EOF

View File

@ -0,0 +1,18 @@
#!/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"
apk del tzdata
else
echo -e "\033[1;38;5;203mNO DEFINED TIMEZONE"
fi

View File

@ -1,3 +1,6 @@
#!/bin/bash
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
rm -f /var/cache/apk/*
chown -R root:root /scripts/

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/util.sh
preInit "/scripts/install.d"

View File

@ -1,5 +1,6 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
bash

View File

@ -0,0 +1,7 @@
#!/bin/bash
if [ "$TZ" != "Europe/Paris" ]; then
apk -U add tzdata
. /scripts/install.d/30-tz.sh
. /scripts/install.d/40-fix.sh
fi

View File

@ -0,0 +1,5 @@
#!/bin/bash
# @app pluie/alpine
# @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"

View File

@ -1,4 +0,0 @@
#!/bin/bash
# ls -la /scripts
chown -R root:root /scripts/

View File

@ -1,31 +1,39 @@
#!/bin/bash
# pluie/docker-images - a-Sansara (https://github.com/a-sansara)
# @app pluie/alpine
# @author a-Sansara https://git.pluie.org/pluie/docker-images
function bash_prompt() {
local Cenv="243"
local Cenvcode="243"
if [ "$SHENV_CTX" = "INT" ]; then
local Cenv="202"
local Cenvcode="202"
elif [ "$SHENV_CTX" = "PROD" ]; then
local Cenv="160"
local Cenvcode="160"
fi
local Cdate="\033[1;33m"
local Cctx="\033[1;48;5;243m"
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"
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}"
}
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

10
pluie/build Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# @app docker-images
# @author a-Sansara https://git.pluie.org/pluie/docker-images
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TAG=${1:-''}
for project in `ls -d */`; do
cd "$DIR/$project"
./build "$tag"
done

14
pluie/libecho/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
FROM pluie/alpine
MAINTAINER a-Sansara https://github.com/a-sansara
ADD files.tar /scripts
ENV SHENV_NAME=libecho \
SHENV_COLOR=32 \
TZ=Europe/Paris
RUN bash /scripts/install.sh

47
pluie/libecho/README.md Normal file
View File

@ -0,0 +1,47 @@
# pluie/libecho
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
demo image demonstrating libpluie-echo, a small vala shared library managing tracing, display formatting and ansi-extended colors on stdout & stderror.
you can run a container with :
```
docker run --rm -it pluie/libecho
```
## repository
https://github.com/pluie-org/libpluie-echo
## samples
![Sample 1 code](https://www.meta-tech.academy/img/libpluie-echo_sample_code1.png?tmp=1)
![Sample 1 output](https://www.meta-tech.academy/img/libpluie-echo_sample1.png)
![Sample 2 code](https://www.meta-tech.academy/img/libpluie-echo_sample_code2.png?tmp=1)
![Sample 2 output](https://www.meta-tech.academy/img/libpluie-echo_sample2.png)
[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/libecho/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

BIN
pluie/libecho/files.tar Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
#!/bin/bash
# @app pluie/alpine-apache
# @author a-Sansara https://git.pluie.org/pluie/docker-images
apk add git vala gcc musl-dev python3 ninja \
&& pip3 install meson \
&& git clone https://github.com/pluie-org/libpluie-echo.git \
&& cd libpluie-echo/ \
&& meson --prefix=/usr ./ build \
&& ninja install -C build

8
pluie/libecho/main.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# @app pluie/libecho
# @author a-Sansara https://git.pluie.org/pluie/docker-images
. /scripts/common.sh
initTitle "Vala shared lib pluie-echo-0.2" "Sample"
/libpluie-echo/samples/pluie-outputFormatter

View File

@ -0,0 +1,2 @@
cd /libpluie-echo/samples
valac --pkg pluie-echo-0.2 pluie-outputFormatter.vala \

14
pluie/libyaml/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
# @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 /bin/bash /scripts/install.sh

63
pluie/libyaml/README.md Normal file
View File

@ -0,0 +1,63 @@
# pluie/libyaml
- [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] ( ~141 MB ) Ubuntu 18.04
- [pluie/libyaml][11] ( ~538 MB ) Vala 0.40.4 pluie-yaml-0.4
- [docker tips][5]
demo image demonstrating pluie-yaml, a shared vala library managing yaml files (v 1.2) and yaml nodes in vala language.
As json is now a valid subset of yaml, you can use this lib to load json files too
you can run a container with :
```
docker run --rm -it pluie/libyaml
```
then execute any samples :
./yaml-loader
./json-loader
./yaml-config
./yaml-traversing
./yaml-finder
./yaml-imports
./yaml-node
## repository
https://github.com/pluie-org/lib-yaml
## samples
./yaml-config source code
![Sample yaml-config code](https://www.meta-tech.academy/img/lib-yaml-config-code.png?tmp=1)
./yaml-config output
![Sample yaml-config output1](https://www.meta-tech.academy/img/lib-yaml-docker-config1.png?tmp=1)
![Sample yaml-config output2](https://www.meta-tech.academy/img/lib-yaml-docker-config2.png?tmp=1)
[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/libyaml/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

BIN
pluie/libyaml/files.tar Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More