1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-16 03:48:44 +00:00

update phpvirtualbox

This commit is contained in:
kev 2019-10-21 16:21:10 +08:00
parent 79d8dac378
commit 3185a204b4
8 changed files with 137 additions and 293 deletions

@ -3,28 +3,23 @@
# #
FROM alpine FROM alpine
MAINTAINER kev <noreply@easypi.pro> MAINTAINER EasyPi Software Foundation
ENV PHPVBOX_VERSION=5.2-1
ENV PHPVBOX_URL=https://github.com/phpvirtualbox/phpvirtualbox/archive/${PHPVBOX_VERSION}.tar.gz
WORKDIR /var/www
RUN set -xe \ RUN set -xe \
&& apk add --no-cache bash nginx php5-fpm php5-cli php5-json php5-soap \ && apk add --no-cache bash nginx php5-fpm php5-cli php5-json php5-soap \
&& apk add --no-cache --virtual build-dependencies wget unzip \ && apk add --no-cache --virtual build-dependencies curl tar \
&& touch /etc/php5/fpm.d/empty.conf \ && touch /etc/php5/fpm.d/empty.conf \
&& wget --no-check-certificate https://sourceforge.net/projects/phpvirtualbox/files/latest/download -O phpvirtualbox.zip \ && curl -sSL ${PHPVBOX_URL} | tar xz --strip 1 \
&& unzip phpvirtualbox.zip -d phpvirtualbox \
&& mkdir -p /var/www \
&& mv -v phpvirtualbox/*/* /var/www/ \
&& rm phpvirtualbox.zip \
&& rm phpvirtualbox/ -R \
&& apk del build-dependencies \ && apk del build-dependencies \
&& rm -rf /var/cache/apk/* \
&& echo "<?php return array(); ?>" > /var/www/config-servers.php \
&& echo "<?php return array(); ?>" > /var/www/config-override.php \
&& chown nobody:nobody -R /var/www && chown nobody:nobody -R /var/www
COPY config.php /var/www/config.php
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
COPY servers-from-env.php /servers-from-env.php
EXPOSE 80 EXPOSE 80
CMD php /servers-from-env.php && php-fpm && nginx CMD php-fpm && nginx

@ -2,29 +2,24 @@
# Dockerfile for phpvirtualbox-arm # Dockerfile for phpvirtualbox-arm
# #
FROM easypi/alpine-arm FROM arm32v7/alpine:3
MAINTAINER kev <noreply@easypi.pro> MAINTAINER EasyPi Software Foundation
ENV PHPVBOX_VERSION=5.2-1
ENV PHPVBOX_URL=https://github.com/phpvirtualbox/phpvirtualbox/archive/${PHPVBOX_VERSION}.tar.gz
WORKDIR /var/www
RUN set -xe \ RUN set -xe \
&& apk add --no-cache bash nginx php5-fpm php5-cli php5-json php5-soap \ && apk add --no-cache bash nginx php5-fpm php5-cli php5-json php5-soap \
&& apk add --no-cache --virtual build-dependencies wget unzip \ && apk add --no-cache --virtual build-dependencies curl tar \
&& touch /etc/php5/fpm.d/empty.conf \ && touch /etc/php5/fpm.d/empty.conf \
&& wget --no-check-certificate https://sourceforge.net/projects/phpvirtualbox/files/latest/download -O phpvirtualbox.zip \ && curl -sSL ${PHPVBOX_URL} | tar xz --strip 1 \
&& unzip phpvirtualbox.zip -d phpvirtualbox \
&& mkdir -p /var/www \
&& mv -v phpvirtualbox/*/* /var/www/ \
&& rm phpvirtualbox.zip \
&& rm phpvirtualbox/ -R \
&& apk del build-dependencies \ && apk del build-dependencies \
&& rm -rf /var/cache/apk/* \
&& echo "<?php return array(); ?>" > /var/www/config-servers.php \
&& echo "<?php return array(); ?>" > /var/www/config-override.php \
&& chown nobody:nobody -R /var/www && chown nobody:nobody -R /var/www
COPY config.php /var/www/config.php
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
COPY servers-from-env.php /servers-from-env.php
EXPOSE 80 EXPOSE 80
CMD php /servers-from-env.php && php-fpm && nginx CMD php-fpm && nginx

@ -1,29 +1,19 @@
<?php <?php
/** /**
* phpVirtualBox example configuration. * phpVirtualBox example configuration.
* @version $Id: config.php-example 452 2012-10-17 12:22:12Z imooreyahoo@gmail.com $ * @version $Id: config.php-example 585 2015-04-04 11:39:31Z imoore76 $
* *
* rename to config.php and edit as needed. * rename to config.php and edit as needed.
* *
*/ */
class phpVBoxConfig { class phpVBoxConfig {
public function __construct() {
// getting servers array
$this->servers = require __DIR__ . '/config-servers.php';
// getting override settings
$overrides = require __DIR__.'/config-override.php';
foreach ($overrides as $key => $value) {
$this->$key = $value;
}
}
/* Username / Password for system user that runs VirtualBox */ /* Username / Password for system user that runs VirtualBox */
var $username = ''; var $username = 'vbox';
var $password = ''; var $password = 'pass';
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ /* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://127.0.0.1:18083/'; var $location = 'http://vboxwebsrv:18083/';
/* Default language. See languages folder for more language options. /* Default language. See languages folder for more language options.
* Can also be changed in File -> Preferences -> Language in * Can also be changed in File -> Preferences -> Language in
@ -33,6 +23,8 @@ class phpVBoxConfig {
/* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */ /* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */
var $vrdeports = '9000-9100'; var $vrdeports = '9000-9100';
/* Set the default VRDE address, e.g. 192.168.1.1 */
#var $vrdeaddress = '192.168.1.1';
/* /*
* *
@ -43,7 +35,6 @@ class phpVBoxConfig {
// Multiple servers example config. Uncomment (remove /* and */) to use. // Multiple servers example config. Uncomment (remove /* and */) to use.
// Add ALL the servers you want to use. Even if you have the server set // Add ALL the servers you want to use. Even if you have the server set
// above. The default server will be the first one in the list. // above. The default server will be the first one in the list.
/* /*
var $servers = array( var $servers = array(
array( array(
@ -54,7 +45,7 @@ class phpVBoxConfig {
'authMaster' => true // Use this server for authentication 'authMaster' => true // Use this server for authentication
), ),
array( array(
'name' => '', 'name' => 'New York',
'username' => 'user2', 'username' => 'user2',
'password' => 'pass2', 'password' => 'pass2',
'location' => 'http://192.168.1.2:18083/' 'location' => 'http://192.168.1.2:18083/'
@ -63,7 +54,7 @@ class phpVBoxConfig {
*/ */
// Disable authentication // Disable authentication
var $noAuth = true; #var $noAuth = true;
// Host / ip to use for console connections // Host / ip to use for console connections
#var $consoleHost = '192.168.1.40'; #var $consoleHost = '192.168.1.40';
@ -116,7 +107,7 @@ class phpVBoxConfig {
var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'); var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
// Restrict locations / folders // Restrict locations / folders
var $browserRestrictFolders = array('/'); // Or something like array('/home/vbox','/var/ISOs') #var $browserRestrictFolders = array('D:\\','C:\\Users\\Ian'); // Or something like array('/home/vbox','/var/ISOs')
// Force use of local, web server based file browser instead of going through vboxwebsrv // Force use of local, web server based file browser instead of going through vboxwebsrv
#var $browserLocal = true; #var $browserLocal = true;
@ -192,7 +183,7 @@ class phpVBoxConfig {
#var $startStopConfig = true; #var $startStopConfig = true;
// Authentication library. // Authentication library.
var $authLib = 'Builtin'; // var $authLib = 'Builtin';
// VM ownership // VM ownership
#var $enforceVMOwnership = true; #var $enforceVMOwnership = true;
@ -222,8 +213,11 @@ class phpVBoxConfig {
*/ */
#var $enableHDFlushConfig = true; #var $enableHDFlushConfig = true;
/*
* Event listener timeout in seconds. This is an advanced option that most people will
* probably not need to change.
*/
#var $eventListenerTimeout = 20;
/* END SETTINGS */ /* END SETTINGS */
} }

@ -2,10 +2,8 @@ phpvirtualbox:
image: easypi/phpvirtualbox-arm image: easypi/phpvirtualbox-arm
ports: ports:
- "8888:80" - "8888:80"
environment: volumes:
- ID_PORT_18083_TCP=remote-server:18083 - ./data/config.php:/var/www/config.php:ro
- ID_NAME=Vbox extra_hosts:
- ID_USER=username - vboxwebsrv:x.x.x.x
- ID_PW=password
- CONF_browserRestrictFolders=/data,
restart: always restart: always

@ -1,65 +0,0 @@
<?php
$servers = array();
$config_overrides = array();
// getting config overrides for all servers
foreach ($_SERVER as $key => $value) {
preg_match('/(.*?)(?:_ENV_|_)?CONF_(.+)/', $key, $matches);
if ($matches) {
$value= (strpos($value, ',')) ? split(',',$value) : $value;
$config_overrides[$matches[1]] = array($matches[2] => $value);
}
}
echo 'Exposing the following linked server instances:' . PHP_EOL;
// getting servers from linked vboxwebsrv containers or environment variables
foreach ($_SERVER as $key => $value) {
if (substr($key, -15) === '_PORT_18083_TCP') {
$prefix = substr($key, 0, -15);
$name = getenv($prefix . '_NAME');
$pos = strrpos($name, '/');
if ($pos !== false) {
$name = substr($name, $pos + 1);
}
if (!$name) {
$name = strtolower($prefix);
}
$name = ucfirst($name);
$location = 'http://' . str_replace('tcp://', '', $value) . '/';
echo '- ' . $name . ' (' . $location .')' . PHP_EOL;
$username = getenv($prefix.'_USER');
$password = getenv($prefix.'_PW');
if ($username == "") $username = 'username';
if ($password == "") $password = 'username';
$servers []= array_merge(array(
'name' => $name,
'username' => $username,
'password' => $password,
'authMaster' => true,
'location' => $location),
(array_key_exists($prefix, $config_overrides)) ? $config_overrides[$prefix] : array());
}
}
// check if there are any servers
if (!$servers) {
echo 'Error: No vboxwebsrv instance linked? Use "--link containername:myname"' . PHP_EOL;
echo 'Use environment variables if no vboxwebsrv containers are used!';
exit(1);
}
// put servers array to file
file_put_contents('/var/www/config-servers.php', '<?php return ' . var_export($servers, true) . ';');
if (array_key_exists("", $config_overrides)) {
// getting global config overrides
file_put_contents('/var/www/config-override.php','<?php return ' . var_export($config_overrides[""], true) . ';' );
}

@ -1,29 +1,19 @@
<?php <?php
/** /**
* phpVirtualBox example configuration. * phpVirtualBox example configuration.
* @version $Id: config.php-example 452 2012-10-17 12:22:12Z imooreyahoo@gmail.com $ * @version $Id: config.php-example 585 2015-04-04 11:39:31Z imoore76 $
* *
* rename to config.php and edit as needed. * rename to config.php and edit as needed.
* *
*/ */
class phpVBoxConfig { class phpVBoxConfig {
public function __construct() {
// getting servers array
$this->servers = require __DIR__ . '/config-servers.php';
// getting override settings
$overrides = require __DIR__.'/config-override.php';
foreach ($overrides as $key => $value) {
$this->$key = $value;
}
}
/* Username / Password for system user that runs VirtualBox */ /* Username / Password for system user that runs VirtualBox */
var $username = ''; var $username = 'vbox';
var $password = ''; var $password = 'pass';
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */ /* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://127.0.0.1:18083/'; var $location = 'http://vboxwebsrv:18083/';
/* Default language. See languages folder for more language options. /* Default language. See languages folder for more language options.
* Can also be changed in File -> Preferences -> Language in * Can also be changed in File -> Preferences -> Language in
@ -33,6 +23,8 @@ class phpVBoxConfig {
/* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */ /* Set the standard VRDE Port Number / Range, e.g. 1010-1020 or 1027 */
var $vrdeports = '9000-9100'; var $vrdeports = '9000-9100';
/* Set the default VRDE address, e.g. 192.168.1.1 */
#var $vrdeaddress = '192.168.1.1';
/* /*
* *
@ -43,7 +35,6 @@ class phpVBoxConfig {
// Multiple servers example config. Uncomment (remove /* and */) to use. // Multiple servers example config. Uncomment (remove /* and */) to use.
// Add ALL the servers you want to use. Even if you have the server set // Add ALL the servers you want to use. Even if you have the server set
// above. The default server will be the first one in the list. // above. The default server will be the first one in the list.
/* /*
var $servers = array( var $servers = array(
array( array(
@ -54,7 +45,7 @@ class phpVBoxConfig {
'authMaster' => true // Use this server for authentication 'authMaster' => true // Use this server for authentication
), ),
array( array(
'name' => '', 'name' => 'New York',
'username' => 'user2', 'username' => 'user2',
'password' => 'pass2', 'password' => 'pass2',
'location' => 'http://192.168.1.2:18083/' 'location' => 'http://192.168.1.2:18083/'
@ -63,7 +54,7 @@ class phpVBoxConfig {
*/ */
// Disable authentication // Disable authentication
var $noAuth = true; #var $noAuth = true;
// Host / ip to use for console connections // Host / ip to use for console connections
#var $consoleHost = '192.168.1.40'; #var $consoleHost = '192.168.1.40';
@ -116,7 +107,7 @@ class phpVBoxConfig {
var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'); var $browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
// Restrict locations / folders // Restrict locations / folders
var $browserRestrictFolders = array('/'); // Or something like array('/home/vbox','/var/ISOs') #var $browserRestrictFolders = array('D:\\','C:\\Users\\Ian'); // Or something like array('/home/vbox','/var/ISOs')
// Force use of local, web server based file browser instead of going through vboxwebsrv // Force use of local, web server based file browser instead of going through vboxwebsrv
#var $browserLocal = true; #var $browserLocal = true;
@ -192,7 +183,7 @@ class phpVBoxConfig {
#var $startStopConfig = true; #var $startStopConfig = true;
// Authentication library. // Authentication library.
var $authLib = 'Builtin'; // var $authLib = 'Builtin';
// VM ownership // VM ownership
#var $enforceVMOwnership = true; #var $enforceVMOwnership = true;
@ -222,8 +213,11 @@ class phpVBoxConfig {
*/ */
#var $enableHDFlushConfig = true; #var $enableHDFlushConfig = true;
/*
* Event listener timeout in seconds. This is an advanced option that most people will
* probably not need to change.
*/
#var $eventListenerTimeout = 20;
/* END SETTINGS */ /* END SETTINGS */
} }

@ -2,10 +2,8 @@ phpvirtualbox:
image: vimagick/phpvirtualbox image: vimagick/phpvirtualbox
ports: ports:
- "8888:80" - "8888:80"
environment: volumes:
- ID_PORT_18083_TCP=remote-server:18083 - ./data/config.php:/var/www/config.php:ro
- ID_NAME=Vbox extra_hosts:
- ID_USER=username - vboxwebsrv:x.x.x.x
- ID_PW=password
- CONF_browserRestrictFolders=/data,
restart: always restart: always

@ -1,65 +0,0 @@
<?php
$servers = array();
$config_overrides = array();
// getting config overrides for all servers
foreach ($_SERVER as $key => $value) {
preg_match('/(.*?)(?:_ENV_|_)?CONF_(.+)/', $key, $matches);
if ($matches) {
$value= (strpos($value, ',')) ? split(',',$value) : $value;
$config_overrides[$matches[1]] = array($matches[2] => $value);
}
}
echo 'Exposing the following linked server instances:' . PHP_EOL;
// getting servers from linked vboxwebsrv containers or environment variables
foreach ($_SERVER as $key => $value) {
if (substr($key, -15) === '_PORT_18083_TCP') {
$prefix = substr($key, 0, -15);
$name = getenv($prefix . '_NAME');
$pos = strrpos($name, '/');
if ($pos !== false) {
$name = substr($name, $pos + 1);
}
if (!$name) {
$name = strtolower($prefix);
}
$name = ucfirst($name);
$location = 'http://' . str_replace('tcp://', '', $value) . '/';
echo '- ' . $name . ' (' . $location .')' . PHP_EOL;
$username = getenv($prefix.'_USER');
$password = getenv($prefix.'_PW');
if ($username == "") $username = 'username';
if ($password == "") $password = 'username';
$servers []= array_merge(array(
'name' => $name,
'username' => $username,
'password' => $password,
'authMaster' => true,
'location' => $location),
(array_key_exists($prefix, $config_overrides)) ? $config_overrides[$prefix] : array());
}
}
// check if there are any servers
if (!$servers) {
echo 'Error: No vboxwebsrv instance linked? Use "--link containername:myname"' . PHP_EOL;
echo 'Use environment variables if no vboxwebsrv containers are used!';
exit(1);
}
// put servers array to file
file_put_contents('/var/www/config-servers.php', '<?php return ' . var_export($servers, true) . ';');
if (array_key_exists("", $config_overrides)) {
// getting global config overrides
file_put_contents('/var/www/config-override.php','<?php return ' . var_export($config_overrides[""], true) . ';' );
}