Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Jan 13, 2016
1 parent 4e893b4 commit 65777ce
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 76 deletions.
153 changes: 92 additions & 61 deletions README.md

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions example/multiple-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# Use single process image example
FROM example/single-process
# Use osixia/light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.1-dev
MAINTAINER Your Name <[email protected]>

# Install multiple process stack and download php5-fpm
# sources: https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service-available
#  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/.cfssl/install.sh
# add non free repository to apt-get install multiple process stack, nginx and php5-fpm
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-multiple-process-stack
RUN echo "deb http://http.debian.net/debian/ jessie main contrib non-free" >> /etc/apt/sources.list \
&& apt-get -y update \
&& /container/tool/install-multiple-process-stack \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
nginx \
php5-fpm

# Add service directory to /container/service
# Content :
# /container/service/nginx (from example/single-process)
# /container/service/php5-fpm
ADD service /container/service

# Use baseimage install-service script and clean all
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service
RUN /container/tool/install-service \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Add default env directory
ADD environment /container/environment/99-default

# Set /var/www/ in a data volume
VOLUME /var/www/

# Expose default http and https ports
EXPOSE 80 443
8 changes: 8 additions & 0 deletions example/multiple-process-image/environment/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is the default image configuration file
# These values will persists in container environment.

# All environment variables used after the container first start
# must be defined here.
# more information : https://github.com/osixia/docker-light-baseimage

WHO_AM_I: We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is the default image startup configuration file
# this file define environment variables used during the container **first start** in **startup files**.

# This file is deleted right after startup files are processed for the first time,
# after that all these values will not be available in the container environment.
# This helps to keep your container configuration secret.
# more information : https://github.com/osixia/docker-light-baseimage

FIRST_START_SETUP_ONLY_SECRET: The bdd password is Baw0unga!
5 changes: 5 additions & 0 deletions example/multiple-process-image/service/nginx/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -e
# this script is run during the image build

rm -rf /var/www/html/index.nginx-debian.html
echo "Hi!" > /var/www/html/index.html
3 changes: 3 additions & 0 deletions example/multiple-process-image/service/nginx/process.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -e
echo "The secret is: $FIRST_START_SETUP_ONLY_SECRET"
exec /usr/sbin/nginx -g "daemon off;"
12 changes: 12 additions & 0 deletions example/multiple-process-image/service/nginx/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e
FIRST_START_DONE="${CONTAINER_STATE_DIR}/nginx-first-start-done"

# container first start
if [ ! -e "$FIRST_START_DONE" ]; then
echo ${WHO_AM_I} >> /var/www/html/index.html
touch $FIRST_START_DONE
fi

echo "The secret is: $FIRST_START_SETUP_ONLY_SECRET"

exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ server {

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
try_files $uri =404;
include fastcgi.conf;
}
}
6 changes: 6 additions & 0 deletions example/multiple-process-image/service/php5-fpm/install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash -e
# this script is run during the image build

# config
sed -i --follow-symlinks -e "s/expose_php = On/expose_php = Off/g" /etc/php5/fpm/php.ini
sed -i --follow-symlinks -e "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini
Expand All @@ -6,3 +9,6 @@ sed -i --follow-symlinks -e "s/;listen.group = www-data/listen.group = www-data/

# replace default website with php5-fpm default website
cp -f /container/service/php5-fpm/config/default /etc/nginx/sites-available/default

# create phpinfo.php
echo "<?php phpinfo(); " > /var/www/html/phpinfo.php
6 changes: 2 additions & 4 deletions example/single-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Use osixia/light-baseimage
# sources: https://github.com/osixia/docker-light-baseimage
# https://github.com/osixia/docker-light-baseimage
FROM osixia/light-baseimage:0.2.1-dev
MAINTAINER Your Name <[email protected]>

# Download nginx and install cfssl from baseimage
# sources: https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service-available
#  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/.cfssl/install.sh
# Install nginx
RUN apt-get -y update \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
nginx
Expand Down

0 comments on commit 65777ce

Please sign in to comment.