From 970d7bdd1bc3dc752b4fe7e90a6c0069d1188b4a Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 19 Nov 2016 16:04:26 +0000 Subject: [PATCH] docker-compose --- etc/dbq.php | 32 ++--- etc/profile.d/docker.sh | 4 + lib/php/db.php | 35 ++---- lib/php/db/config.php | 9 ++ lib/php/db/table.php | 132 ++++++++++----------- lib/php/db/types/sqlite.php | 1 - lib/php/nb.php | 3 + src/Docker/Compose/dbq/docker-compose.yaml | 5 +- src/Docker/Compose/up.sh | 1 + src/Docker/nginx/Dockerfile | 1 + src/Docker/php/Dockerfile | 4 +- 11 files changed, 113 insertions(+), 114 deletions(-) create mode 100644 src/Docker/Compose/up.sh diff --git a/etc/dbq.php b/etc/dbq.php index bdbe6a87..be2771a0 100644 --- a/etc/dbq.php +++ b/etc/dbq.php @@ -8,7 +8,7 @@ $LOCAL_DB = ( ) ? true : false; # -# Search existing DIR_SQLITE +# DIR_SQLITE=*/var/lib/sqlite # unset($DIR_SQLITE); foreach ([ @@ -86,45 +86,45 @@ $DBQ['all'] = [ foreach ($DBQ as $id => $db) { if (0 + or empty($db['type'] ) or $db['type']!='sqlite' + or empty($db['host'] ) or !is_readable($db['host']) or !strpos($db['host'],'.db') + ) continue; $fname = basename($db['host'],'.db'); $fname = preg_replace('/\..*$/','',basename($db['host'])); $DBQ['all']['types']['sql_pre'][] = "ATTACH DATABASE '".$db['host']."' as ".$fname.""; + if (!isset($DBQ[$fname]['name'])) $DBQ[$fname]['name'] = $fname; conf_merge($DBQ[$fname],$DBQ['all']); } conf_merge($DBQ['nb'],$DBQ['all']); -#var_dump($DBQ['all']['types']['sql_pre']); - -return 1; function conf_merge(&$c1,&$c2) { - if (!empty($c1['tables'])) { - if (empty($c1['tables'])) $c1['tables'] = []; - foreach ($c1['tables'] as $k=>$v) { - #debug($k); - $c2['tables'][$k] = $v; - } - } - + // .* foreach ([ 'default_table', 'title', 'row_parse', #'_import', - ] as $k) if (!empty($c1[$k])) - $c2[$k] = $c1[$k]; - ; + ] as $k) { + if (isset($c1[$k])) $c2[$k] = $c1[$k]; + } + + // tables.* + if (!empty($c1['tables'])) { + foreach ((array)$c1['tables'] as $k=>$v) { + $c2['tables'][$k] = $v + ['database' => $c1['name']]; + } + } return [$c1,$c2]; } - ?> diff --git a/etc/profile.d/docker.sh b/etc/profile.d/docker.sh index 019694fe..8f519ecc 100644 --- a/etc/profile.d/docker.sh +++ b/etc/profile.d/docker.sh @@ -17,6 +17,10 @@ if [ -z "$MYVIMRC" ]; then #[ -z "$DOCKER_CERT_PATH" -o ! -e "$DOCKER_CERT_PATH" ] && which docker-machine>/dev/null && docker-machine ls -q 2>/dev/null |grep -qFm1 "$DOCKER_MACHINE_NAME" && eval "$(docker-machine env "$DOCKER_MACHINE_NAME")" 2>/dev/null fi +docker_machine_shared() { + VBoxManage showvminfo "$DOCKER_MACHINE_NAME" | perl -ne "print qq|\$2\t\$1\n| if /^Name: '(.*?)', Host path: '(.*?)'/" +} + docker_build() { shell_help "Usage: $FUNCNAME [DIR_DOCKERFILE]" "$@" && return diff --git a/lib/php/db.php b/lib/php/db.php index 3902a42b..6e014d75 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -243,8 +243,8 @@ class Db extends nb { } public function connect() { - if (!empty($this->conn)) return false; + # Pdo if (empty($this->pdo)) $this->bye("db: `".$this->id."`: Missing pdo: check host, name, user, password"); if (empty($this->pdo)) return false; @@ -253,10 +253,6 @@ class Db extends nb { $this->conf_type_load(); # Connect - #debug([$this->pdo,$this->user,$this->password,$this->options]); - #$this->conn = new PDO($this->pdo,$this->user,$this->password); - #bye('zaza'); - #if (false) { try { $this->conn = new PDO($this->pdo,$this->user,$this->password,$this->options); #if (isset($this->pdo_error)) $this->conn->setAttribute($this->pdo_error[0], $this->pdo_error[1]); @@ -270,7 +266,6 @@ class Db extends nb { #throw new Exception($msg, (int)$e->getCode()); self::bye($msg); } - #} if (empty($this->conn)) { $this->bye("Connection failed: ".$this->pdo_info()); @@ -288,7 +283,6 @@ class Db extends nb { foreach ($this->sql_pre() as $s) { $this->conn->exec($s); } - # Bye return true; } @@ -297,15 +291,8 @@ class Db extends nb { try { #$r = $this->conn->exec($sql,$params); $r = $this->conn->exec($sql); - /* - if ($params === null) { - $r = $this->conn->exec($sql,$params); - } else { - $r = $this->conn->exec($sql); - } - */ } catch (PDOException $e) { - err(join(': ',array($e->getMessage(),"Db.exec()",$sql))); + err(join(': ',[$e->getMessage(),"Db.exec()",$sql])); $r = null; } @@ -313,12 +300,12 @@ class Db extends nb { } public function query($sql) { - # See: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers + # See: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers try { $r = $this->conn->query($sql); } catch (PDOException $e) { - err(join(': ',array($e->getMessage(),"Db.query()",$sql))); + err(join(': ',[$e->getMessage(),"Db.query()",$sql])); $r = null; } @@ -619,6 +606,7 @@ class Db extends nb { #if ($this->p('fields')) $row['fields'] = $t->status('fields'); if ($this->p('fields')) $row['fields'] = join(',',array_keys($t->fields())); + #debug($t->name.'='.$t->database); $rows[] = $row; } @@ -654,7 +642,6 @@ class Db extends nb { # $dbs = []; - #if (is_scalar($files)) $files = array($files); foreach ((array)$files as $file) { $file = self::untilde($file); @@ -768,11 +755,11 @@ class Db extends nb { if (empty($conf[$id])) return []; # Construct assoc array - $db = array_merge($conf[$id],array( + $db = array_merge($conf[$id],[ #'dbs' => array_keys($conf), 'conf' => $conf, 'id' => $id, - )); + ]); return $db; } @@ -1015,10 +1002,10 @@ class Db extends nb { #'conf' => count(array_keys($this->conf)), 'tables' => count($this->tables()), ] - +($this->conf_type('use_path') ? [] : array( + +($this->conf_type('use_path') ? [] : [ 'port' => $this->port, 'user' => $this->user, - )) + ]) +$new; if (($sqls=$this->conf_type('status'))) { @@ -1048,10 +1035,10 @@ class Db extends nb { #debug($new); foreach ($new as $k=>$v) { - $status[] = array( + $status[] = [ 'name' => $k, 'value' => $v, - ); + ]; } return $status; diff --git a/lib/php/db/config.php b/lib/php/db/config.php index fe94fa82..994ca07e 100644 --- a/lib/php/db/config.php +++ b/lib/php/db/config.php @@ -2,6 +2,15 @@ require_once(realpath(dirname(__FILE__).'/../config.php')); require_once(realpath(dirname(__FILE__).'/../db.php')); +# NB 19.11.16: TODEL +foreach ([ + Db::ROOT_DIR.'/etc/dbs.yaml', + Db::ROOT_DIR.'/etc/dbs.php', + '/etc/dbs.yaml', +] as $file) { + if (file_exists($file)) nb::msg("Delete obsolete file: $file (".__FILE__.")"); +} + $DB_CONFS = Db::conf_load( glob('/etc/dbq/*.yaml')+ glob('/etc/dbq/*.php')+ diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 79a6eae2..2656fc75 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -2,14 +2,10 @@ require_once(realpath(dirname(__FILE__).'/../db.php')); require_once(realpath(dirname(__FILE__).'/../db/field.php')); require_once(realpath(dirname(__FILE__).'/../out.php')); -#$a = array('a','b','c'); $b = array('c','a'); debug(array_diff($a,$b)); define('TABLE_INDENT',NB_EOL ? "\t" : ""); define('TABLE_CSV_SEP',nb::p('sep') ? nb::p('sep') : "\t"); -#if (!defined('DB_HTML_BUTTON_SUBMIT')) define('DB_HTML_BUTTON_SUBMIT',''); -#if (!defined('DB_HTML_BUTTON_ADD')) define('DB_HTML_BUTTON_ADD','Add'); -#if (!defined('DB_HTML_BUTTON_ADD')) define('DB_HTML_BUTTON_ADD',''); if (!defined('DB_HTML_EDIT')) define('DB_HTML_EDIT','Edit'); if (!defined('DB_HTML_DELETE')) define('DB_HTML_DELETE','Delete'); @@ -275,7 +271,7 @@ Class Table extends nb { $this->fields = []; $conf = $this->unvar($this->db()->conf_type('table.fields',true)); - if (is_scalar($conf)) $conf = array('sql'=>$conf); + if (is_scalar($conf)) $conf = ['sql'=>$conf]; $rows = $this->db()->conn->query($conf['sql']); $rows->setFetchMode(PDO::FETCH_ASSOC); @@ -307,7 +303,7 @@ Class Table extends nb { if (isset($conf['fct'])) $conf['fct']($row) ; - $field = array( + $field = [ 'table' => $this, 'name' => $row['name'], 'type' => strtolower($row['type']), @@ -316,7 +312,8 @@ Class Table extends nb { 'null' => (preg_match('/^(f.*|no|0)?\s*$/i',$row['null']) ? 0 : 1), 'extra' => (isset($row['extra']) ? $row['extra'] : null), # !!! nothing todo with array $extra, this info from the sql server 'autoincrement' => (isset($row['autoincrement']) ? $row['autoincrement'] : 0), - ); + ]; + if (isset($row['uniq'])) $field['uniq'] = $row['uniq']; if (isset($row['default'])) $field['default'] = $row['default']; @@ -340,9 +337,9 @@ Class Table extends nb { return $this->fields; } - public function url_keys($values=null,$params=array(),$sep='&') { + public function url_keys($values=null,$params=[],$sep='&') { if ($values === null) $values = $this->p(); - $url = is_array($params) ? $params : array($params); + $url = is_array($params) ? $params : [$params]; $keys = $this->fields_keys($others); if (empty($keys)) $keys = $others; @@ -358,9 +355,9 @@ Class Table extends nb { return $url ? '?'.join($sep,$url) : ''; } - public function fields_keys(&$others=array()) { + public function fields_keys(&$others=[]) { - $fields_keys = array(); + $fields_keys = []; foreach ($this->fields() as $name => $f) { if ($f->key) { @@ -374,7 +371,7 @@ Class Table extends nb { } - public static function form_hidden($ignore=array()) { + public static function form_hidden($ignore=[]) { $h = ''; foreach (array_diff(self::$params,$ignore) as $p) { if ($v=self::p($p)) { @@ -387,7 +384,7 @@ Class Table extends nb { public function html_edit($values = null) { if ($values === null) $values = $this->p(); - if (!is_array($values)) $values = array($values); + if (!is_array($values)) $values = [$values]; $fields = array_filter($this->fields(),function($v){return empty($v->extra);}); #$fields = $this->fields(); #debug($fields); @@ -440,7 +437,7 @@ Class Table extends nb { echo '' .'' - .self::form_hidden(array('action','HTTP_REFERER')) + .self::form_hidden(['action','HTTP_REFERER']) .(!empty($_SERVER['HTTP_REFERER']) ? '' : '') .''.NB_EOL; @@ -448,10 +445,10 @@ Class Table extends nb { public function url_list($k='',$v='') { - $params = array(); - $fields = ($this->p('action') == 'delete') ? array() : $this->fields(); + $params = []; + $fields = ($this->p('action') == 'delete') ? [] : $this->fields(); - foreach ( array_diff( array_merge(self::$params,array_keys($fields)), array('action') ) as $f) { + foreach ( array_diff( array_merge(self::$params,array_keys($fields)), ['action'] ) as $f) { if (strcmp($this->p($f,''),'')==0) continue; $params[$f] = $this->p($f); @@ -469,7 +466,7 @@ Class Table extends nb { } # NB 03.04.16 if ($this->p('db')) $params['db'] = $this->p('db'); - $flat = array(); + $flat = []; foreach ($params as $k=>$v) { $flat[] = $k.'='.urlencode($v); } return $flat ? '?'. join('&',$flat) : ''; @@ -511,7 +508,7 @@ Class Table extends nb { if ($count<$tot) { list($x,$y) = strpos($limit,',')!==false ? preg_split('/\s*,\s*/',$limit) - : array(0,$limit) + : [0,$limit] ; $prev = $x - $y; @@ -539,7 +536,7 @@ Class Table extends nb { public function where($fields,$hvalues,$need_all_values=false) { // Construct where - $where = array(); + $where = []; foreach ($fields as $k => $field) { if (!isset($hvalues[$k])) { if ($need_all_values) return null; @@ -547,15 +544,13 @@ Class Table extends nb { } $where[] = $field->sql_name() . '=' . $field->quote($hvalues[$k]); } - #var_dump($where); exit; - #.' VALUES (' . join(',',ar_map('":$a"',$fields)).')' return empty($where) ? '' : ' WHERE ' . join(' AND ',$where); } public function where_criterias($values,$logic='') { - $having = $where = array(); + $having = $where = []; if (empty($logic)) $logic = 'AND'; $regexp = $this->db()->conf_type('regexp'); @@ -662,11 +657,11 @@ Class Table extends nb { continue; } - $v = new Field( ( is_array($v) ? $v : array() ) + array( + $v = new Field( ( is_array($v) ? $v : [] ) + [ 'name' => $k, 'type' => 'text', 'extras' => $v, - )); + ]); $this->fields[$k] = $v; $this->extras[$k] = $v; @@ -690,7 +685,7 @@ Class Table extends nb { /****************************************************************** Html Output ******************************************************************/ - public function rows_sql(&$opt=array()) { + public function rows_sql(&$opt=[]) { if (isset($this->orderby)) self::pdef('orderby',$this->orderby); if (self::p('order')) self::pset('orderby',self::p('orderby').' '.self::p('order')); # from Wordpress @@ -709,14 +704,14 @@ Class Table extends nb { $where = $this->where_criterias($this->p(),$this->p('op')); $select_count = ( $where ? $this->db()->conf_type('select_count') : null ); - if (empty($select_count)) $select_count = array('',''); + if (empty($select_count)) $select_count = ['','']; if (!empty($this->_rows_fields)) { foreach ($this->fields() as $f) { if (empty($f->extra)) $select_fields[] = $f->sql_name(); } } else { - $select_fields = array('*'); + $select_fields = ['*']; } $sql = "SELECT ".trim( $select_count[0].' '.join(',',$select_fields) ). $this->select_extras(); @@ -741,7 +736,7 @@ Class Table extends nb { # NB 28.03.16 $this->sql = $sql; $this->debug(preg_replace('/[\r\n]+[ ]*/',' ',$sql),1); # NB 03.09.16 $this->debug(preg_replace('/(,|FROM|WHERE|HAVING|GROUP|ORDER)/i',"\n\\1",$sql),1); - return array($sql,$where,$limit,$select_count); + return [$sql,$where,$limit,$select_count]; } public function buttons() { @@ -975,11 +970,11 @@ Class Table extends nb { $limit = preg_replace('/^.*,\s*/','',$this->limit); - $this->_html_table->set_pagination_args(array( + $this->_html_table->set_pagination_args([ 'total_items' => $this->tot, // total items defined above 'per_page' => $limit, // per page constant defined at top of method 'total_pages' => ceil($this->tot / $limit) // calculate pages count - )); + ]); #$this->_html_table->display_tablenav('top'); $this->_html_table->display(); @@ -997,7 +992,7 @@ Class Table extends nb { } public function rows_rec_sql(&$row,&$opt) { - $keys = $values = array(); + $keys = $values = []; foreach ($row as $k=>$v) { if (isset($this->extras[$k])) continue; @@ -1165,7 +1160,7 @@ Class Table extends nb { return $html; } - public function rows_end_table($opt=array()) { + public function rows_end_table($opt=[]) { $html = ''; $html .= ''.NB_EOL; $html .= ''.NB_EOL; @@ -1203,7 +1198,7 @@ Class Table extends nb { return $html; } - public function rows_end_div($opt=array()) { + public function rows_end_div($opt=[]) { return ''.NB_EOL; } @@ -1211,15 +1206,15 @@ Class Table extends nb { return $this->db()->sql_name($value === null ? $this->name : $value); } - public function replace($hvalues,&$info=array()) { + public function replace($hvalues,&$info=[]) { return $this->insert($hvalues,$info,'REPLACE'); } - public function insert($hvalues,&$info=array(),$insert_word='INSERT') { - if (empty($info['values'])) $info['values'] = array(); + public function insert($hvalues,&$info=[],$insert_word='INSERT') { + if (empty($info['values'])) $info['values'] = []; $info['values'] = $hvalues; - $sql_names = $fields = $values = array(); + $sql_names = $fields = $values = []; foreach ($this->fields() as $name => $field) { if (!isset($hvalues[$name])) continue; @@ -1268,17 +1263,17 @@ Class Table extends nb { } # dbq t=nb.mime_type a=table.update type=application/rss+xml name='RSS - Really Simple Syndication' ext=rss debug=2 - public function update($hvalues,&$info=array()) { - if (empty($info['values'])) $info['values'] = array(); + public function update($hvalues,&$info=[]) { + if (empty($info['values'])) $info['values'] = []; $info['values'] = $hvalues; - $keys = array(); - $keys_values = array(); - $fields = array(); - $fields_values = array(); + $keys = []; + $keys_values = []; + $fields = []; + $fields_values = []; - #$update = array(); - #$where = array(); + #$update = []; + #$where = []; foreach ($this->fields() as $name => $field) { @@ -1351,8 +1346,8 @@ Class Table extends nb { } - public function delete($hvalues,&$info=array()) { - if (empty($info['values'])) $info['values'] = array(); + public function delete($hvalues,&$info=[]) { + if (empty($info['values'])) $info['values'] = []; $info['values'] = $hvalues; $keys = $this->fields_keys(); @@ -1378,7 +1373,7 @@ Class Table extends nb { return $info['rowCount']; } - public function out($v,$head=array()) { return $this->db()->out($v,$head); } + public function out($v,$head=[]) { return $this->db()->out($v,$head); } private function url_referer($default='') { if (self::p('referer')) { @@ -1458,7 +1453,7 @@ Class Table extends nb { } elseif ($this->p('format') and !preg_match('/^(table|div)$/',$this->p('format'))) { - $this->rows($dummy,array('format' => $this->p('format'))); + $this->rows($dummy,['format' => $this->p('format')]); return true; } elseif ($action == 'edit') { @@ -1477,13 +1472,13 @@ Class Table extends nb { } public function html_row_buttons(&$row) { - return array( + return [ ''.DB_HTML_EDIT.''.NB_EOL, ''.DB_HTML_DELETE.''.NB_EOL, - ); + ]; } public function html_rows_top() { @@ -1492,7 +1487,7 @@ Class Table extends nb { if (!empty($this->replace)) { - $replace = array(); + $replace = []; foreach ($this->replace as $k=>$v) { $replace[] = "$k.$v"; } $html .= ''.NB_EOL; @@ -1542,50 +1537,50 @@ Class Table extends nb { $r .= '
'; // Hiddens - $r .= self::form_hidden(array('db','table','format','limit','download')); + $r .= self::form_hidden(['db','table','format','limit','download']); $r .= ''; // Embed for no html format // Tables - see default.js if you change class $r .= ''; - $r .= ''.html_select_array(array_keys($this->db()->tables()),array( + $r .= ''.html_select_array(array_keys($this->db()->tables()),[ 'html' => 'class="tables" name="table" id="table"', 'selected' => $this->p('table'), 'prettyText' => true, 'sort' => 'natcasesort', - )); + ]); $r .= ''; // Dbs - see default.js if you change class if (!empty($this->db()->dbs) and count($this->db()->dbs)>1) { $r .= ''; - $r .= ''.html_select_array($this->db()->dbs,array( + $r .= ''.html_select_array($this->db()->dbs,[ 'html' => 'class="dbs" id="db" name="db" onchange="document.location=\''.preg_replace('/\?.*$/','',$_SERVER['REQUEST_URI']).'?db=\'+this.value"', 'selected' => self::p('db'), 'prettyText' => true, 'sort' => 'natcasesort', - )); + ]); $r .= ''; } // Format $r .= ''; - $r .= ''.html_select_array($this->db()->formats,array( + $r .= ''.html_select_array($this->db()->formats,[ 'html' => 'class="format" name="format" id="format"', 'selected' => $this->p('format'), 'prettyText' => true, 'sort' => 'natcasesort', - )); + ]); $r .= ''; // Limit if (!empty($this->db()->limits)) { $r .= ''; - $r .= ''.html_select_array($this->db()->limits,array( + $r .= ''.html_select_array($this->db()->limits,[ 'html' => 'class="limit" name="limit" id="limit"', 'selected' => $this->p('limit'), 'prettyText' => true, - )); + ]); $r .= ''; } @@ -1595,11 +1590,11 @@ Class Table extends nb { // Order By /* $r .= ''; - $r .= ''.html_select_array(array_keys($this->fields()),array( + $r .= ''.html_select_array(array_keys($this->fields()),[ 'html' => 'class="orderby" name="orderby" id="orderby"', 'selected' => $this->p('orderby'), 'prettyText' => true, - )); + ]); $r .= ''; */ @@ -1642,7 +1637,7 @@ Class Table extends nb { } public function __sleep() { - return array( + return [ 'name', 'sql', 'type', @@ -1653,7 +1648,7 @@ Class Table extends nb { 'count', 'engine', 'created', - ); + ]; } public function serialize() { @@ -1722,7 +1717,6 @@ Class Table extends nb { } } - #$key = 'count'; # Params foreach ([ 'count', @@ -1737,15 +1731,11 @@ Class Table extends nb { if ($k!=$key) continue; } - # No count for view - #if ($k == 'count' and $this->type != 'table') continue; - $this->status[$k] = $this->$k(); if (is_array($this->status[$k])) $this->status[$k] = count($this->status[$k]); } if (!empty($key)) return ( empty($this->status[$key]) ? '' : $this->status[$key] ); -#debug($this->name.'='.$this->type); return $this->status; } diff --git a/lib/php/db/types/sqlite.php b/lib/php/db/types/sqlite.php index 771024af..48d95ac3 100644 --- a/lib/php/db/types/sqlite.php +++ b/lib/php/db/types/sqlite.php @@ -21,7 +21,6 @@ $DB_TYPES['sqlite'] = array ( }, 'databases' => [ 'PRAGMA database_list',function(&$r) { -#debug($GLOBALS['Db']->databases()); if (empty($r['file'])) $r = null;; unset($r['seq']); }, diff --git a/lib/php/nb.php b/lib/php/nb.php index 64508bf1..4fb4af40 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -788,14 +788,17 @@ class NB { public static function array_fill_assoc($rows) { $keys = []; + foreach($rows as $k=>$v) { $keys = array_merge_recursive(array_keys($v),$keys); } + foreach($rows as $k=>$v) { foreach ($keys as $key) { if (empty($v[$key])) $rows[$k][$key] = ''; } } + return $rows; } diff --git a/src/Docker/Compose/dbq/docker-compose.yaml b/src/Docker/Compose/dbq/docker-compose.yaml index e2712891..07f9798b 100644 --- a/src/Docker/Compose/dbq/docker-compose.yaml +++ b/src/Docker/Compose/dbq/docker-compose.yaml @@ -1,12 +1,15 @@ php: build: ../../php/ volumes: - - ./../../../:/opt/nb + #- ./../../../..:/opt/nb + - ./../../../../..:/opt + - ./../../../../lib/php/db:/var/www/html expose: - 9000 nginx: build: ../../nginx/ + #image: nginx:latest ports: - 80:80 links: diff --git a/src/Docker/Compose/up.sh b/src/Docker/Compose/up.sh new file mode 100644 index 00000000..0d328c16 --- /dev/null +++ b/src/Docker/Compose/up.sh @@ -0,0 +1 @@ +docker-compose up --force-recreate --build --remove-orphans -d diff --git a/src/Docker/nginx/Dockerfile b/src/Docker/nginx/Dockerfile index e085cd61..d5d804b5 100644 --- a/src/Docker/nginx/Dockerfile +++ b/src/Docker/nginx/Dockerfile @@ -1,2 +1,3 @@ FROM nginx:latest COPY ./default.conf /etc/nginx/conf.d/default.conf +CMD nginx -g 'daemon off;' diff --git a/src/Docker/php/Dockerfile b/src/Docker/php/Dockerfile index cafc9402..a3f65d0b 100644 --- a/src/Docker/php/Dockerfile +++ b/src/Docker/php/Dockerfile @@ -5,6 +5,8 @@ FROM php:7.0-fpm-alpine #RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql RUN set -ex && apk --no-cache add postgresql-dev RUN docker-php-ext-install pdo pdo_mysql pdo_sqlite pdo_sqlite pdo_pgsql pgsql +RUN mkdir /opt EXPOSE 9000 -CMD ["/usr/bin/php", "-a"] +#CMD ["/usr/local/bin/php", "-a"] +CMD /usr/local/sbin/php-fpm -- 2.47.3