Add Dockerfile

This commit is contained in:
nemunaire 2014-12-28 11:53:28 +01:00
parent a0954215f8
commit c3641d3f27
3 changed files with 58 additions and 0 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
onyx2/log/*.log

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
# DOCKER-VERSION 1.3.2
FROM debian:wheezy
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>
# Install packages ####################################################
RUN apt-get -y update && \
apt-get install -y \
nginx-light \
php5-fpm \
php5-gd \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /srv/www/pa4home
EXPOSE 80
COPY entrypoint.sh /root/entrypoint.sh
ENTRYPOINT ["/root/entrypoint.sh"]
RUN ln -sf /srv/www/pa4home/onyx/config/root.sample.xml /srv/www/pa4home/onyx/config/root.xml
# Webserver configuration #############################################
COPY nginx.conf /etc/nginx/sites-available/default
COPY htdocs /srv/www/pa4home/htdocs/
COPY onyx2 /srv/www/pa4home/onyx2/
CMD service nginx start && \
service php5-fpm start && \
/bin/bash

23
entrypoint.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
BASEDIR=/srv/www/pa4home
# Creating directory and set permissions
mkdir -p ${BASEDIR}/onyx/log
chown -R www-data:www-data ${BASEDIR}/onyx/log
# Update database profile
cat <<EOF > ${BASEDIR}/onyx/db/docker.profile.php &&
<?php
if(!defined('ONYX')) exit;
\$___profile['db'] = '$DB_ENV_MYSQL_DATABASE';
\$___profile['host'] = '$DB_PORT_3306_TCP_ADDR';
\$___profile['user'] = '$DB_ENV_MYSQL_USER';
\$___profile['pass'] = '$DB_ENV_MYSQL_PASSWORD';
EOF
sed -i 's/"profile">sample</"profile">docker</' ${BASEDIR}/onyx/config/root.xml
# Continue execution
exec "$@"