forked from osixia/container-baseimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2058740
commit 4e893b4
Showing
13 changed files
with
512 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
example/multiple-process-image/service/php5-fpm/config/default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash -e | ||
exec /usr/sbin/php5-fpm --nodaemonize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
9
example/single-process-image/environment/default.yaml.startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |