Skip to content

Commit

Permalink
Add Docker support: Dockerfile initial version and environment-sourci…
Browse files Browse the repository at this point in the history
…ng config file.
  • Loading branch information
pataquets committed Jul 18, 2015
1 parent e2c827d commit aaac0f4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM composer/composer

ADD . /src/app/
WORKDIR /src/app

RUN \
composer install && \
cp includes/config.environment.inc.php includes/config.inc.php

EXPOSE 80

ENTRYPOINT [ "php", "-S", "0.0.0.0:80" ]
46 changes: 46 additions & 0 deletions includes/config.environment.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

include 'config.sample.inc.php';

$admin_user = getenv('ADMIN_USER');
$admin_pass = getenv('ADMIN_PASS');

if (!empty($admin_user)) {
$config['login'] = array(
$admin_user => array(
'password' => $admin_pass,
),
);
}

$i=1;

while (TRUE) {

$prefix = 'REDIS_' . $i . '_';

$server_name = getenv($prefix . 'NAME');
$server_host = getenv($prefix . 'HOST');
$server_port = getenv($prefix . 'PORT');

if (empty($server_host)) {
break;
}

if (empty($server_name)) {
$server_name = $server_host;
}

if (empty($server_port)) {
$server_port = 6379;
}

$config['servers'][] = array(
'name' => $server_name,
'host' => $server_host,
'port' => $server_port,
'filter' => '*',
);

$i++;
}

0 comments on commit aaac0f4

Please sign in to comment.