mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2025-12-24 01:57:51 -05:00
Add back database Dockerfile (#3584)
This commit is contained in:
13
.travis.yml
13
.travis.yml
@@ -17,23 +17,24 @@ before_install:
|
||||
|
||||
script:
|
||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
- docker run --rm -v $(pwd):/app opensourcepos/composer composer install
|
||||
- docker run --rm -v $(pwd):/app opensourcepos/composer:ci4 composer install
|
||||
- version=$(grep application_version app/Config/App.php | sed "s/.*=\s'\(.*\)';/\1/g")
|
||||
- sed -i "s/commit_sha1 = 'dev'/commit_sha1 = '$rev'/g" app/Config/OSPOS.php
|
||||
- echo "$version-$branch-$rev"
|
||||
- npm version "$version-$branch-$rev" --force || true
|
||||
- docker run --rm -it -v $(pwd):/app -w /app opensourcepos/node-grunt-bower
|
||||
sh -c "npm install && npm run build"
|
||||
- docker run --privileged --rm -it -v $(pwd):/app -w /app node
|
||||
sh -c "npm install && npm install -g gulp && npm run build"
|
||||
- docker build . --target ospos -t ospos
|
||||
- docker build database/ -t jekkos/opensourcepos:sqlscript
|
||||
- docker build app/Database/ -t "jekkos/opensourcepos:sql-$TAG"
|
||||
env:
|
||||
global:
|
||||
- DOCKER_COMPOSE_VERSION=1.29.1
|
||||
- BRANCH=$(echo ${TRAVIS_BRANCH} | sed s/feature\\///)
|
||||
- TAG=${TRAVIS_TAG:-$BRANCH}
|
||||
- date=`date +%Y%m%d%H%M%S` && branch=${TRAVIS_BRANCH} && rev=`git rev-parse --short=6 HEAD`
|
||||
after_success:
|
||||
- TAG=${TRAVIS_TAG:-$BRANCH}
|
||||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker tag "ospos:latest"
|
||||
"jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:sqlscript"
|
||||
"jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:sql-$TAG"
|
||||
- sudo mv dist/opensourcepos.tgz "dist/opensourcepos.$version.$rev.tgz"
|
||||
- sudo mv dist/opensourcepos.zip "dist/opensourcepos.$version.$rev.zip"
|
||||
before_deploy:
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -1,10 +1,9 @@
|
||||
FROM php:8-apache AS ospos
|
||||
LABEL maintainer="jekkos"
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libicu-dev \
|
||||
libgd-dev \
|
||||
openssl
|
||||
# workaround for travis docker issue (https://stackoverflow.com/questions/71941032/why-i-cannot-run-apt-update-inside-a-fresh-ubuntu22-04)
|
||||
RUN sed -i -e 's/^APT/# APT/' -e 's/^DPkg/# DPkg/' /etc/apt/apt.conf.d/docker-clean
|
||||
RUN apt update && apt-get install -y libicu-dev libgd-dev
|
||||
|
||||
RUN a2enmod rewrite headers
|
||||
RUN docker-php-ext-install mysqli bcmath intl gd
|
||||
@@ -13,7 +12,7 @@ RUN echo "date.timezone = \"\${PHP_TIMEZONE}\"" > /usr/local/etc/php/conf.d/time
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html
|
||||
RUN chmod -R 750 /app/writable/uploads /app/writable/logs && chown -R www-data:www-data /app/writable
|
||||
RUN chmod -R 770 /app/writable/uploads /app/writable/logs /app/writable/cache && chown -R www-data:www-data /app
|
||||
|
||||
FROM ospos AS ospos_test
|
||||
|
||||
@@ -33,5 +32,5 @@ FROM ospos AS ospos_dev
|
||||
RUN mkdir -p /app/bower_components && ln -s /app/bower_components /var/www/html/bower_components
|
||||
RUN yes | pecl install xdebug \
|
||||
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
|
||||
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
|
||||
&& echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
|
||||
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
@@ -9,27 +9,55 @@ use CodeIgniter\Database\Config;
|
||||
*/
|
||||
class Database extends Config
|
||||
{
|
||||
/**
|
||||
* The directory that holds the Migrations
|
||||
* and Seeds directories.
|
||||
*/
|
||||
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||
/**
|
||||
* The directory that holds the Migrations
|
||||
* and Seeds directories.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Lets you choose which connection group to
|
||||
* use if no other is specified.
|
||||
*/
|
||||
public string $defaultGroup = 'default';
|
||||
/**
|
||||
* Lets you choose which connection group to
|
||||
* use if no other is specified.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $defaultGroup = 'default';
|
||||
|
||||
/**
|
||||
* The default database connection.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public array $default = [
|
||||
public $default;
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $tests;
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* developing against non-production data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $development;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->default = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'admin',
|
||||
'password' => 'pointofsale',
|
||||
'database' => 'ospos',
|
||||
'hostname' => !empty(getenv('MYSQL_HOST_NAME')) ? getenv('MYSQL_HOST_NAME') : 'localhost',
|
||||
'username' => !empty(getenv('MYSQL_USERNAME')) ? getenv('MYSQL_USERNAME') : 'admin',
|
||||
'password' => !empty(getenv('MYSQL_PASSWORD')) ? getenv('MYSQL_PASSWORD') : 'pointofsale',
|
||||
'database' => !empty(getenv('MYSQL_DB_NAME')) ? getenv('MYSQL_DB_NAME') : 'ospos',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => 'ospos_',
|
||||
'pConnect' => false,
|
||||
@@ -44,67 +72,53 @@ class Database extends Config
|
||||
'port' => 3306
|
||||
];
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
*/
|
||||
public array $tests = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'admin',
|
||||
'password' => 'pointofsale',
|
||||
'database' => 'ospos',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => 'ospos_',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
$this->development = [
|
||||
'DSN' => '',
|
||||
'hostname' => !empty(getenv('MYSQL_HOST_NAME')) ? getenv('MYSQL_HOST_NAME') : 'localhost',
|
||||
'username' => !empty(getenv('MYSQL_USERNAME')) ? getenv('MYSQL_USERNAME') : 'admin',
|
||||
'password' => !empty(getenv('MYSQL_PASSWORD')) ? getenv('MYSQL_PASSWORD') : 'pointofsale',
|
||||
'database' => !empty(getenv('MYSQL_DB_NAME')) ? getenv('MYSQL_DB_NAME') : 'ospos',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => 'ospos_',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306
|
||||
];
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* developing against non-production data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $development = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'admin',
|
||||
'password' => 'pointofsale',
|
||||
'database' => 'ospos',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => 'ospos_',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
$this->tests = [
|
||||
'DSN' => '',
|
||||
'hostname' => !empty(getenv('MYSQL_HOST_NAME')) ? getenv('MYSQL_HOST_NAME') : 'localhost',
|
||||
'username' => !empty(getenv('MYSQL_USERNAME')) ? getenv('MYSQL_USERNAME') : 'admin',
|
||||
'password' => !empty(getenv('MYSQL_PASSWORD')) ? getenv('MYSQL_PASSWORD') : 'pointofsale',
|
||||
'database' => !empty(getenv('MYSQL_DB_NAME')) ? getenv('MYSQL_DB_NAME') : 'ospos',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => 'ospos_',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->development['hostname'] = getenv('MYSQL_HOST_NAME') ? getenv('MYSQL_HOST_NAME') : 'localhost';
|
||||
$this->development['username'] = getenv('MYSQL_USERNAME') ? getenv('MYSQL_USERNAME') : 'admin';
|
||||
$this->development['password'] = getenv('MYSQL_PASSWORD') ? getenv('MYSQL_PASSWORD') : 'pointofsale';
|
||||
|
||||
// Ensure that we always set the database group to 'tests' if
|
||||
// we are currently running an automated test suite, so that
|
||||
// we don't overwrite live data on accident.
|
||||
// Ensure that we always set the database group to 'tests' if
|
||||
// we are currently running an automated test suite, so that
|
||||
// we don't overwrite live data on accident.
|
||||
switch(ENVIRONMENT)
|
||||
{
|
||||
case 'testing':
|
||||
@@ -114,5 +128,5 @@ class Database extends Config
|
||||
$this->defaultGroup = 'development';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: '3.7'
|
||||
version: '2'
|
||||
|
||||
volumes:
|
||||
uploads:
|
||||
@@ -32,6 +32,7 @@ services:
|
||||
- logs:/app/application/logs
|
||||
environment:
|
||||
- PHP_TIMEZONE=UTC
|
||||
- CI_ENVIRONMENT=development
|
||||
- MYSQL_USERNAME=admin
|
||||
- MYSQL_PASSWORD=pointofsale
|
||||
- MYSQL_DB_NAME=ospos
|
||||
@@ -47,7 +48,7 @@ services:
|
||||
networks:
|
||||
- db_net
|
||||
volumes:
|
||||
- ./database/database.sql:/docker-entrypoint-initdb.d/database.sql
|
||||
- ./app/Database/database.sql:/docker-entrypoint-initdb.d/database.sql
|
||||
- mysql:/var/lib/mysql:rw
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=pointofsale
|
||||
|
||||
@@ -14,10 +14,10 @@ networks:
|
||||
|
||||
services:
|
||||
sqlscript:
|
||||
image: jekkos/opensourcepos:sqlscript
|
||||
image: jekkos/opensourcepos:sql-ci4
|
||||
command: /bin/sh -c 'exit 0'
|
||||
ospos:
|
||||
image: jekkos/opensourcepos:3.3.8
|
||||
image: jekkos/opensourcepos:ci4-upgrade
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
@@ -30,7 +30,7 @@ services:
|
||||
- uploads:/app/public/uploads
|
||||
- logs:/app/application/logs
|
||||
environment:
|
||||
- CI_ENV=production
|
||||
- CI_ENVIRONMENT=production
|
||||
- FORCE_HTTPS=false
|
||||
- PHP_TIMEZONE=UTC
|
||||
- MYSQL_USERNAME=admin
|
||||
|
||||
Reference in New Issue
Block a user