Add a Dockerfile for development purpose

This commit is contained in:
nemunaire 2014-08-27 12:26:49 +02:00
parent 30dc461270
commit 4ca3e56856
2 changed files with 126 additions and 0 deletions

45
Dockerfile Normal file
View File

@ -0,0 +1,45 @@
# DOCKER-VERSION 1.1.0
# /!\ WARNING: the container generated through this Dockerfile is made only for development purpose; it is NOT SAFE or production ready.
FROM debian:wheezy
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>
# Install packages ####################################################
RUN apt-get -y update
RUN apt-get install -y nginx-light php5-fpm mysql-server php5-mysql pwgen openssl
# Copying files #######################################################
ADD . /var/www/fic2014-server/
# Configure softwares #################################################
RUN ln -sf /var/www/fic2014-server/nginx-server.conf /etc/nginx/sites-enabled/default
RUN ln -sf /var/www/fic2014-server/php-fpm.conf /etc/php5/fpm/pool.d/www.conf
# Generate test certificates ##########################################
RUN cd /var/www/fic2014-server/misc; bash ./CA.sh -newca
# Import DB ###########################################################
RUN service mysql start && echo "CREATE DATABASE fic2014;" | mysql -u root && cat /var/www/fic2014-server/db/fic2014.sql | mysql -u root fic2014
# Uncomment the following line to fill with random values
#RUN cat /var/www/fic2014-server/db/feed.sql | mysql -u root fic2014
# Configure site ######################################################
RUN ln -sf /var/www/fic2014-server/onyx/config/sample.root.xml /var/www/fic2014-server/onyx/config/root.xml
RUN sed -i "s/1386827772/`date -d 'now + 4 hours' +%s`/" /var/www/fic2014-server/onyx/config/root.xml
RUN sed -i "s/challenge-public//" /var/www/fic2014-server/onyx/config/root.xml
RUN chmod 777 /var/www/fic2014-server/onyx/cache/ /var/www/fic2014-server/onyx/cache/templates/cache/ /var/www/fic2014-server/onyx/cache/templates/compile/
# ENVIRONNEMENT #######################################################
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 80/tcp 443/tcp
CMD ["sh", "-c", "cd /var/www/fic2014-server/misc; if ! [ -f server.crt ]; then bash ./CA.sh -newserver; fi; service nginx start && service php5-fpm start && service mysql start && /bin/bash"]

81
php-fpm.conf Normal file
View File

@ -0,0 +1,81 @@
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www-data
group = www-data
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php-fpm.sock
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
listen.owner = www-data
listen.group = www-data
listen.mode = 0640
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 200
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 10
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 5
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 10