summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-08-19 01:38:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-08-19 01:38:49 +0200
commit2a154a6cf5b7bf17f8a992bb9507bba37b0543be (patch)
tree283861a83fa61237de6e233d0cb6b651db622716
parentaa2242090433be62d3f88ec6b402d1554606c0f2 (diff)
Update docker setup
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--Dockerfile4
-rwxr-xr-xdocker/filebin_starter.sh40
2 files changed, 36 insertions, 8 deletions
diff --git a/Dockerfile b/Dockerfile
index 0b18a4e81..9b6c8f705 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
FROM alpine:edge
MAINTAINER Sebastian Rakel <sebastian@devunit.eu>
-RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing bash php5 py-pygments py2-pip imagemagick php5-gd nodejs composer php5-pdo_mysql php5-exif
+RUN apk add --no-cache -X https://dl-cdn.alpinelinux.org/alpine/edge/testing bash php7 py-pygments py2-pip imagemagick php7-gd nodejs composer php7-pdo_mysql php7-exif php7-ctype php7-session git
ENV FILEBIN_HOME_DIR /var/lib/filebin
ENV FILEBIN_DIR $FILEBIN_HOME_DIR/filebin
@@ -9,7 +9,7 @@ ENV FILEBIN_DIR $FILEBIN_HOME_DIR/filebin
ADD . $FILEBIN_DIR
RUN adduser -S -h $FILEBIN_HOME_DIR filebin
-RUN chown filebin: -R $FILEBIN_HOME_DIR
+RUN chown filebin: -R $FILEBIN_HOME_DIR
RUN pip install ansi2html
diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh
index 4fa50d583..7f0b70d85 100755
--- a/docker/filebin_starter.sh
+++ b/docker/filebin_starter.sh
@@ -1,15 +1,44 @@
#!/bin/bash
+#set -euo pipefail
+
function set_config() {
FB_ENCRYPTION_KEY=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32`
- sed -i "s/\$config\['encryption_key'\] = ''/\$config['encryption_key'] = '${FB_ENCRYPTION_KEY}'/" ${FILEBIN_DIR}/application/config/config-local.php
+cat <<EOF >${FILEBIN_DIR}/application/config/config-local.php
+<?php
+\$config['base_url'] = 'http://127.0.0.1:8080/';
+\$config['encryption_key'] = '${FB_ENCRYPTION_KEY}';
+EOF
}
function set_database_config() {
- sed -i "s/\$db\['default'\]\['hostname'\] = .*/\$db['default']['hostname'] = \"${FB_DB_HOSTNAME}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['username'\] = .*/\$db['default']['username'] = \"${FB_DB_USERNAME}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['password'\] = .*/\$db['default']['password'] = \"${FB_DB_PASSWORD}\";/" ${FILEBIN_DIR}/application/config/database.php
- sed -i "s/\$db\['default'\]\['database'\] = .*/\$db['default']['database'] = \"${FB_DB_DATABASE}\";/" ${FILEBIN_DIR}/application/config/database.php
+cat <<EOF >${FILEBIN_DIR}/application/config/database.php
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+\$active_group = 'default';
+\$query_builder = TRUE;
+
+\$db['default'] = array(
+ 'dsn' => 'mysql:host=${FB_DB_HOSTNAME};dbname=${FB_DB_DATABASE}',
+ 'hostname' => '',
+ 'port' => 3306,
+ 'username' => '${FB_DB_USERNAME}',
+ 'password' => '${FB_DB_PASSWORD}',
+ 'database' => '',
+ 'dbdriver' => 'pdo',
+ 'dbprefix' => '',
+ 'pconnect' => FALSE,
+ 'db_debug' => TRUE,
+ 'char_set' => 'utf8mb4', // if you use postgres, set this to utf8
+ 'dbcollat' => 'utf8mb4_bin', // if you use postgres, set this to utf8_bin
+ 'swap_pre' => '',
+ 'encrypt' => FALSE,
+ 'compress' => FALSE,
+ 'stricton' => TRUE,
+ 'failover' => array(),
+ 'save_queries' => TRUE
+);
+EOF
}
# wait for DB to be ready
@@ -21,7 +50,6 @@ done
if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then
echo "no config found, new config will be generated"
- cp $FILEBIN_DIR/application/config/example/config-local.php ${FILEBIN_DIR}/application/config/config-local.php
set_config
set_database_config