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 2058740 commit 4e893b4
Show file tree
Hide file tree
Showing 13 changed files with 512 additions and 11 deletions.
373 changes: 362 additions & 11 deletions README.md

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions example/multiple-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use single process image example
FROM example/single-process
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
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 \
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/*
11 changes: 11 additions & 0 deletions example/multiple-process-image/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME = example/multiple-process

.PHONY: all build build-nocache

all: build

build:
docker build -t $(NAME) --rm .

build-nocache:
docker build -t $(NAME) --no-cache --rm .
28 changes: 28 additions & 0 deletions example/multiple-process-image/service/php5-fpm/config/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

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;
}
}
8 changes: 8 additions & 0 deletions example/multiple-process-image/service/php5-fpm/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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
sed -i --follow-symlinks -e "s/;listen.owner = www-data/listen.owner = www-data/g" /etc/php5/fpm/pool.d/www.conf
sed -i --follow-symlinks -e "s/;listen.group = www-data/listen.group = www-data/g" /etc/php5/fpm/pool.d/www.conf

# replace default website with php5-fpm default website
cp -f /container/service/php5-fpm/config/default /etc/nginx/sites-available/default
2 changes: 2 additions & 0 deletions example/multiple-process-image/service/php5-fpm/process.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash -e
exec /usr/sbin/php5-fpm --nodaemonize
29 changes: 29 additions & 0 deletions example/single-process-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use osixia/light-baseimage
# sources: 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
RUN apt-get -y update \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
nginx

# Add service directory to /container/service
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
11 changes: 11 additions & 0 deletions example/single-process-image/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME = example/single-process

.PHONY: all build build-nocache

all: build

build:
docker build -t $(NAME) --rm .

build-nocache:
docker build -t $(NAME) --no-cache --rm .
8 changes: 8 additions & 0 deletions example/single-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.
9 changes: 9 additions & 0 deletions example/single-process-image/environment/default.yaml.startup
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/single-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/single-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/single-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

0 comments on commit 4e893b4

Please sign in to comment.