Skip to content

Commit

Permalink
Set docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
rantes committed Aug 14, 2023
1 parent 14353db commit 43cd94c
Show file tree
Hide file tree
Showing 15 changed files with 5,303 additions and 24 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ app/webroot/test.html
*.po~
*.po
coverage.xml
test-result.xml
test-result.xml
dbdata
dbdata/
8 changes: 8 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ app/webroot/$1 [QSA,L]

RewriteRule ^(?:app|core|migrations|vendor|config)\b app/webroot/index.php?url=$0 [L]

</IfModule>
85 changes: 85 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
FROM php:8.2-apache as builder

# RUN mkdir -p /var/www
# WORKDIR /var/www

RUN apt update && apt dist-upgrade -y

RUN apt install -y \
# php-xdebug \
git \
curl \
zip \
sqlite3 \
libbz2-dev \
libsqlite3-dev \
libssl-dev \
libcurl4-openssl-dev \
libjpeg-dev \
libonig-dev \
libreadline-dev \
libtidy-dev \
libxslt-dev \
libzip-dev \
net-tools \
iputils-ping \
nano

# RUN apk add --update --no-cache --virtual .build-deps \
# autoconf g++ make \
# curl \
# git \
# zip \
# libxml2-dev \
# libzip-dev \
# sqlite \
# sqlite-dev \
# icu-dev \
# gettext-dev \
# nano

# RUN docker-php-ext-install intl && docker-php-ext-enable intl
RUN docker-php-ext-install gettext && docker-php-ext-enable gettext
RUN docker-php-ext-install pdo_mysql && docker-php-ext-enable pdo_mysql
RUN docker-php-ext-install pdo_sqlite && docker-php-ext-enable pdo_sqlite
# RUN docker-php-ext-install sockets && docker-php-ext-enable sockets
RUN pecl install -f xdebug
# RUN docker-php-ext-enable xdebug

RUN yes | pecl install ${XDEBUG_VERSION} \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

COPY config/php.ini /usr/local/etc/php/conf.d/local.ini

RUN a2enmod rewrite
RUN a2enmod deflate

RUN apachectl -M

FROM builder as dependencies
RUN echo $(php -v)
WORKDIR /
RUN mkdir -p /usr/bin/
RUN cp $(which php) /usr/bin/

WORKDIR /tmp

RUN git clone https://github.com/rantes/DumboPHP.git
WORKDIR /tmp/DumboPHP

RUN php install.php

FROM dependencies as release
WORKDIR /var/www/html
USER www-data

RUN echo 'Running migrations...'
RUN php /usr/local/bin/dumbo migration run all
RUN echo 'Running sowing seeds...'
RUN php /usr/local/bin/dumbo migration sow

EXPOSE 80

# CMD ["sh", "./docker-startup.sh"]
5 changes: 4 additions & 1 deletion app/controllers/admin_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require_once INST_PATH.'app/controllers/admin_base_trait.php';
require_once INST_PATH.'app/controllers/common_trait.php';
class AdminController extends Page {
use AdminBaseTrait;
use CommonTrait;
use AdminBaseTrait;

public $layout = 'layout';
public $helper = ['Sessions','Menu'];
Expand All @@ -13,6 +13,9 @@ class AdminController extends Page {

public function __construct() {
parent::__construct();
$this->exceptsBeforeFilter = [
'actions' => 'signin,login,logout'
];

textdomain('translations');
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/common_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function signinAction() {
*/
public function logoutAction() {
$this->layout = false;
php_sapi_name() !== 'cli' && session_destroy();
php_sapi_name() !== 'cli' and session_destroy();
$_SESSION = null;
unset($_SESSION);
header("Location: /{$this->controller}/login");
Expand Down
Loading

0 comments on commit 43cd94c

Please sign in to comment.