First working docker version.

This commit is contained in:
mihasinkec 2020-07-08 16:04:28 +02:00
parent 54736f4d12
commit bee8e58982
4 changed files with 27 additions and 10 deletions

View File

@ -3,6 +3,8 @@ FROM php:7.2-apache
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN docker-php-ext-install pdo_mysql
# Enable rewrite module for httpd.
RUN ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

View File

@ -9,10 +9,10 @@
class DBconnect {
private static $host = getenv('DB_HOST') ?: "localhost";
private static $user = getenv('DB_USER') ?: "nermin";
private static $password = getenv('DB_PASS') ?: "";
private static $schema = getenv('DB_SCHEMA') ?: "dialectsdb";
private static $host = "localhost";
private static $user = "nermin";
private static $password = "";
private static $schema = "dialectsdb";
private static $instance = null;
private function __construct() {
@ -31,6 +31,21 @@ class DBconnect {
* @return PDO instance
*/
public static function getInstance() {
// Check for config overrides via enviroment variables.
if (getenv('DB_HOST')) {
self::$host = getenv('DB_HOST');
}
if (getenv('DB_USER')) {
self::$user = getenv('DB_USER');
}
if (getenv('DB_PASS')) {
self::$password = getenv('DB_PASS');
}
if (getenv('DB_SCHEMA')) {
self::$schema = getenv('DB_SCHEMA');
}
if (!self::$instance) {
$config = "mysql:host=" . self::$host
. ";dbname=" . self::$schema;

View File

@ -6,7 +6,7 @@ services:
ports:
- "5000:80"
volumes:
- <pot do zvočnih datotek>:/var/lib/www/iknb/resources/audio
- <pot do zvočnih datotek>:/var/www/html/resources/audio
environment:
DB_HOST: db
DB_USER: nermin

View File

@ -28,10 +28,10 @@
<script src="vendor/ui-leaflet.js"></script>
-->
<script src="http://angular-ui.github.io/ui-leaflet/bower_components/leaflet/dist/leaflet.js"></script>
<script src="http://angular-ui.github.io/ui-leaflet/bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
<script src="http://angular-ui.github.io/ui-leaflet/dist/ui-leaflet.min.js"></script>
<link href="http://angular-ui.github.io/ui-leaflet/bower_components/leaflet/dist/leaflet.css" rel="stylesheet" />
<script src="https://angular-ui.github.io/ui-leaflet/bower_components/leaflet/dist/leaflet.js"></script>
<script src="https://angular-ui.github.io/ui-leaflet/bower_components/angular-simple-logger/dist/angular-simple-logger.js"></script>
<script src="https://angular-ui.github.io/ui-leaflet/dist/ui-leaflet.min.js"></script>
<link href="https://angular-ui.github.io/ui-leaflet/bower_components/leaflet/dist/leaflet.css" rel="stylesheet" />
<script src="vendor/leaflet.pattern.js"></script>
<!--<script src="vendor/leaflet.extra-markers.min.js"></script>