add pluie/alpine-symfony image
This commit is contained in:
parent
28334d5314
commit
6f22d95e79
11
DOCKER.md
11
DOCKER.md
|
@ -115,6 +115,17 @@ docker run --name apache --restart=always \
|
|||
-d pluie/alpine-apache
|
||||
```
|
||||
|
||||
### Symfony
|
||||
```
|
||||
cd /home/dev/docker
|
||||
docker run --name symfony --restart=always \
|
||||
--net home0 -h symfony.docker --ip 172.22.0.7 --link=mysql:db \
|
||||
-e HTTP_SERVER_NAME=symfony \
|
||||
-e SYMFONY_VERSION=2.8 \
|
||||
-v $(pwd)/repo/myapp:/app \
|
||||
-d pluie/alpine-symfony
|
||||
```
|
||||
|
||||
#### Wordpress
|
||||
```
|
||||
cd /home/dev/docker
|
||||
|
|
|
@ -6,7 +6,9 @@ various based images for Docker
|
|||
|
||||
- [pluie/alpine][2] ( < 10 MB ) Alpine/3.4
|
||||
- [pluie/alpine-apache][3] ( ~ 50 MB ) Apache/2.4.23 Php/5.6.24
|
||||
- [image pluie/alpine-symfony][6] ( ~ 81 MB )
|
||||
- [pluie/alpine-mysql][4] ( ~172 MB ) Mysql/5.5.47 ( MariaDB )
|
||||
|
||||
- [docker tips][5]
|
||||
|
||||
## Base Image Structure
|
||||
|
@ -22,7 +24,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
|
||||
|
@ -74,3 +76,4 @@ you can keep same __build__ script in any project
|
|||
[3]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-mysql
|
||||
[4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache
|
||||
[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
|
||||
|
|
|
@ -10,6 +10,8 @@ ADD files.tar /scripts
|
|||
ENV SHENV_NAME=Apache \
|
||||
SHENV_COLOR=67 \
|
||||
HTTP_SERVER_NAME=docker-site.dev \
|
||||
WWW_DIR=www \
|
||||
WWW_INDEX=index \
|
||||
FIX_OWNERSHIP=1 \
|
||||
TZ=Europe/Paris
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- [index][1]
|
||||
- [image pluie/alpine][2]
|
||||
- [image pluie/alpine-mysql][3]
|
||||
- [image pluie/alpine-symfony][6]
|
||||
- [docker tips][5]
|
||||
|
||||
Extend pluie/alpine with __apache 2.4.23__ and __php 5.6.24__
|
||||
|
@ -17,17 +18,34 @@ Extend pluie/alpine with __apache 2.4.23__ and __php 5.6.24__
|
|||
|
||||
- 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
|
||||
|
@ -65,3 +83,4 @@ $ docker exec -it apache "httpd -h"
|
|||
[3]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-mysql
|
||||
[4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache
|
||||
[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
|
||||
|
|
Binary file not shown.
|
@ -2,13 +2,15 @@
|
|||
# @app pluie/alpine-apache
|
||||
# @author a-Sansara https://git.pluie.org/pluie/docker-images
|
||||
|
||||
mkdir -p /app/www
|
||||
chown -R 1000:apache /app/www
|
||||
mkdir -p /app/$WWW_DIR
|
||||
chown -R 1000:apache /app/$WWW_DIR
|
||||
chmod -R 755 /scripts/pre-init.d
|
||||
mkdir -p /run/apache2
|
||||
chown apache:apache /run/apache2
|
||||
sed -i 's#^DocumentRoot ".*#DocumentRoot "/app/www"#g' /etc/apache2/httpd.conf
|
||||
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
|
||||
sed -i 's#\#LoadModule rewrite_module modules/mod_rewrite.so#LoadModule rewrite_module modules/mod_rewrite.so#' /etc/apache2/httpd.conf
|
||||
sed -ir 's/expose_php = On/expose_php = Off/' /etc/php5/php.ini
|
||||
echo -e "\nIncludeOptional /app/vhost" >> /etc/apache2/httpd.conf
|
||||
unset tmpsed
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# @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 [ ! -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
|
||||
|
|
|
@ -6,15 +6,15 @@ if [ ! -z "/app/vhost" ]; then
|
|||
cat <<EOF > "/app/vhost"
|
||||
<VirtualHost *:80>
|
||||
ServerName $HTTP_SERVER_NAME
|
||||
<Directory /app/www>
|
||||
<Directory /app/$WWW_DIR>
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
DirectoryIndex index.php
|
||||
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>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- [index][1]
|
||||
- [image pluie/alpine][2]
|
||||
- [image pluie/alpine-apache][4]
|
||||
- [image pluie/alpine-symfony][6]
|
||||
- [docker tips][5]
|
||||
|
||||
Extend pluie/alpine with mysql (mariadb) 5.5.47
|
||||
|
@ -129,3 +130,4 @@ docker run --name mycontainer --link mysql:db ...
|
|||
[3]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-mysql
|
||||
[4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache
|
||||
[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
|
||||
|
|
19
pluie/alpine-symfony/Dockerfile
Normal file
19
pluie/alpine-symfony/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
# @app pluie/alpine-symfony
|
||||
# @author a-Sansara https://git.pluie.org/pluie/docker-images
|
||||
|
||||
FROM pluie/alpine-apache
|
||||
|
||||
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.1
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
RUN bash /scripts/install.sh
|
74
pluie/alpine-symfony/README.md
Normal file
74
pluie/alpine-symfony/README.md
Normal file
|
@ -0,0 +1,74 @@
|
|||
# pluie/alpine-symfony
|
||||
|
||||
- [index][1]
|
||||
- [image pluie/alpine][2]
|
||||
- [image pluie/alpine-mysql][3]
|
||||
- [image pluie/alpine-apache][4]
|
||||
- [image pluie/alpine-symfony][6]
|
||||
- [docker tips][5]
|
||||
|
||||
Extend pluie/alpine-apache.
|
||||
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 ~ 81 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
|
||||
|
||||
|
||||
## Image Usage
|
||||
|
||||
chdir to your project directory
|
||||
```
|
||||
$ docker run --name symfony -it --link=mysql:db1 -v $(pwd):/app pluie/alpine-symfony
|
||||
```
|
||||
or
|
||||
```
|
||||
$ docker run --name symfony -it --link=mysql:db1 -e HTTP_SERVER_NAME=yourServerName -v $(pwd):/app pluie/alpine-symfony
|
||||
```
|
||||
|
||||
## Connect to container
|
||||
|
||||
```
|
||||
$ docker exec -it symfony bash
|
||||
```
|
||||
|
||||
## Controling http server
|
||||
|
||||
```
|
||||
$ 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-mysql
|
||||
[4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache
|
||||
[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
|
22
pluie/alpine-symfony/build
Executable file
22
pluie/alpine-symfony/build
Executable 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
|
BIN
pluie/alpine-symfony/files.tar
Normal file
BIN
pluie/alpine-symfony/files.tar
Normal file
Binary file not shown.
7
pluie/alpine-symfony/install.d/10-symfony.sh
Executable file
7
pluie/alpine-symfony/install.d/10-symfony.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
# @app pluie/alpine-symfony
|
||||
# @author a-Sansara https://git.pluie.org/pluie/docker-images
|
||||
|
||||
apk -U add php5-iconv php5-intl php5-posix
|
||||
curl -LsS https://symfony.com/installer -o /usr/bin/symfony
|
||||
chmod +x /usr/bin/symfony
|
13
pluie/alpine-symfony/pre-init.d/10-symfony.sh
Normal file
13
pluie/alpine-symfony/pre-init.d/10-symfony.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
# @app pluie/alpine-symfony
|
||||
# @author a-Sansara https://git.pluie.org/pluie/docker-images
|
||||
|
||||
|
||||
if [ ! -d /app/$WWW_DIR ]; then
|
||||
cd /tmp
|
||||
mkdir $WWW_DIR
|
||||
symfony new app $SYMFONY_VERSION
|
||||
mv app/* /app/
|
||||
chown -R 1000:apache /app/
|
||||
chmod -R g+w /app
|
||||
fi
|
|
@ -3,6 +3,7 @@
|
|||
- [index][1]
|
||||
- [image pluie/alpine-mysql][3]
|
||||
- [image pluie/alpine-apache][4]
|
||||
- [image pluie/alpine-symfony][6]
|
||||
- [docker tips][5]
|
||||
|
||||
This Image provide a Linux Alpine distribution with :
|
||||
|
@ -15,6 +16,11 @@ Base image : [alpine:3.4] (https://hub.docker.com/_/alpine/)
|
|||
|
||||
This project come with a structure to facilitate further images (like pluie/alpine-apache & pluie/alpine-mysql)
|
||||
|
||||
__note :__ wget ssl issue
|
||||
|
||||
apk add ca-certificates wget && update-ca-certificates
|
||||
|
||||
|
||||
## Image Size
|
||||
|
||||
- very small image < 10 MB
|
||||
|
@ -39,7 +45,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
|
||||
|
@ -89,3 +95,4 @@ VOLUME /app
|
|||
[3]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-mysql
|
||||
[4]: https://github.com/pluie-org/docker-images/tree/master/pluie/alpine-apache
|
||||
[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
|
||||
|
|
Loading…
Reference in New Issue
Block a user