Skip to content

Commit 37db04d

Browse files
committed
11.2: * [Docker] Updated the Docker examples with automatic configuration from .env.
1 parent ea435d8 commit 37db04d

10 files changed

Lines changed: 35 additions & 161 deletions

File tree

install/docker/.env.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CERB_SERVICE_TOKEN=sk_docker_token
2+
CERB_SERVICE_SCOPE='cron update'

install/docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ VOLUME /var/www/html/
88

99
RUN apt-get update && apt-get install -y --no-install-recommends \
1010
ca-certificates \
11+
gettext-base \
1112
php8.3-bcmath \
1213
php8.3-curl \
1314
php8.3-dom \
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,2 @@
11
<?php
2-
const APP_DB_HOST = 'mysql';
3-
const APP_DB_USER = 'cerb';
4-
const APP_DB_PASS = 's3cr3t';
5-
const APP_DB_DATABASE = 'cerb';
6-
7-
const APP_SERVICE_TOKEN = 'sk_docker_token';
8-
const APP_SERVICE_TOKEN_SCOPE = 'cron update';
9-
10-
const DEVELOPMENT_MODE = true;
11-
12-
/****************************************************************************
13-
* [JAS]: Don't change the following unless you know what you're doing!
14-
***************************************************************************/
15-
define('APP_PATH',dirname(__FILE__));
16-
const APP_STORAGE_PATH = APP_PATH . '/storage';
17-
const APP_TEMP_PATH = APP_STORAGE_PATH . '/tmp';
18-
const DEVBLOCKS_PATH = APP_PATH . '/libs/devblocks/';
19-
const DEVBLOCKS_REWRITE = true;
20-
const APP_DEFAULT_CONTROLLER = 'core.controller.page';
21-
22-
require_once(DEVBLOCKS_PATH . 'framework.defaults.php');
2+
// This file will be automatically generated by the container
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
const APP_DB_HOST = '${CERB_DB_HOST}';
3+
const APP_DB_USER = '${CERB_DB_USER}';
4+
const APP_DB_PASS = '${CERB_DB_PASS}';
5+
const APP_DB_DATABASE = '${CERB_DB_NAME}';
6+
7+
const APP_SERVICE_TOKEN = '${CERB_SERVICE_TOKEN}';
8+
const APP_SERVICE_TOKEN_SCOPE = '${CERB_SERVICE_TOKEN_SCOPE}';
9+
10+
const DEVELOPMENT_MODE = true;
11+
12+
/****************************************************************************
13+
* [JAS]: Don't change the following unless you know what you're doing!
14+
***************************************************************************/
15+
define('APP_PATH',dirname(__FILE__));
16+
const APP_STORAGE_PATH = APP_PATH . '/storage';
17+
const APP_TEMP_PATH = APP_STORAGE_PATH . '/tmp';
18+
const DEVBLOCKS_PATH = APP_PATH . '/libs/devblocks/';
19+
const DEVBLOCKS_REWRITE = true;
20+
const APP_DEFAULT_CONTROLLER = 'core.controller.page';
21+
22+
require_once(DEVBLOCKS_PATH . 'framework.defaults.php');

install/docker/_conf/entry.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
22
chown www-data:www-data /var/www/html/storage \
33
&& chmod 0770 /var/www/html/storage \
4+
&& envsubst "\$CERB_DB_HOST \$CERB_DB_NAME \$CERB_DB_USER \$CERB_DB_PASS \$CERB_SERVICE_TOKEN \$CERB_SERVICE_TOKEN_SCOPE" \
5+
< /tmp/cerb.framework.config.template > /var/www/html/framework.config.php \
46
&& php-fpm8.3 -F

install/docker/dev/Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

install/docker/dev/_conf/entry.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

install/docker/dev/docker-compose.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

install/docker/docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ services:
2020
depends_on:
2121
- mysql
2222
environment:
23+
CERB_DB_HOST: mysql
24+
CERB_DB_NAME: ${MYSQL_DATABASE:-cerb}
25+
CERB_DB_USER: ${MYSQL_USER:-cerb}
26+
CERB_DB_PASS: ${MYSQL_PASSWORD:-s3cr3t}
2327
CERB_SERVICE_TOKEN: ${CERB_SERVICE_TOKEN:-sk_docker_token}
28+
CERB_SERVICE_TOKEN_SCOPE: ${CERB_SERVICE_TOKEN_SCOPE:-cron update}
2429
volumes:
2530
- ../..:/var/www/html:ro
26-
- ./_conf/cerb.config.php:/var/www/html/framework.config.php:ro
31+
- ./_conf/cerb.config.template.php:/tmp/cerb.framework.config.template:ro
32+
- ./_conf/cerb.config.php:/var/www/html/framework.config.php
2733
- storage:/var/www/html/storage
2834
mysql:
2935
image: mysql:8.4

install/docker/example-template/docker-compose.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)