diff --git a/.env b/.env new file mode 100644 index 0000000..6b1dc06 --- /dev/null +++ b/.env @@ -0,0 +1,71 @@ +CONTAINER_PORT=63102 +UID=1000 +#-------------------------------------------------------------------- +# Example Environment Configuration file +# +# This file can be used as a starting point for your own +# custom .env files, and contains most of the possible settings +# available in a default install. +# +# By default, all of the settings are commented out. If you want +# to override the setting, you must un-comment it by removing the '#' +# at the beginning of the line. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# ENVIRONMENT +#-------------------------------------------------------------------- + +# CI_ENVIRONMENT = production + +#-------------------------------------------------------------------- +# APP +#-------------------------------------------------------------------- + +# app.baseURL = '' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' +# app.forceGlobalSecureRequests = false +# app.CSPEnabled = false + +#-------------------------------------------------------------------- +# DATABASE +#-------------------------------------------------------------------- + +# database.default.hostname = localhost +# database.default.database = ci4 +# database.default.username = root +# database.default.password = root +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.port = 3306 + +# If you use MySQLi as tests, first update the values of Config\Database::$tests. +# database.tests.hostname = localhost +# database.tests.database = ci4_test +# database.tests.username = root +# database.tests.password = root +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.charset = utf8mb4 +# database.tests.DBCollat = utf8mb4_general_ci +# database.tests.port = 3306 + +#-------------------------------------------------------------------- +# ENCRYPTION +#-------------------------------------------------------------------- + +# encryption.key = + +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.savePath = null + +#-------------------------------------------------------------------- +# LOGGER +#-------------------------------------------------------------------- + +# logger.threshold = 4 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b9cd0de --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' +services: + merms-kevkem: + build: + context: . + dockerfile: docker/apache/Dockerfile + args: + uid: ${UID} + environment: + - APACHE_RUN_USER=#${UID} + - APACHE_RUN_GROUP=#${UID} + #- CI_ENV + - CI_CONFIG + restart: unless-stopped + volumes: + - ./:/var/www/html + - ./apache_log:/var/log/apache2 + ports: + - "${CONTAINER_PORT}:80" + extra_hosts: + - "host.docker.internal:host-gateway" + - oameye.works.wrenchboard.com:10.20.30.27 + - oameye.work.wrenchboard.com:10.10.33.15 +volumes: + src: diff --git a/docker/apache/000-default.conf b/docker/apache/000-default.conf new file mode 100644 index 0000000..613ea1f --- /dev/null +++ b/docker/apache/000-default.conf @@ -0,0 +1,11 @@ + + ServerAdmin works@chiefsoft.com + ServerName oameye.works.wrenchboard.com + DocumentRoot /var/www/html/public + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + \ No newline at end of file diff --git a/docker/apache/Dockerfile b/docker/apache/Dockerfile new file mode 100644 index 0000000..b90fed8 --- /dev/null +++ b/docker/apache/Dockerfile @@ -0,0 +1,56 @@ +# Use an official PHP runtime as a base image +FROM php:8.1-apache + +RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf +#RUN apt-get update + +RUN apt-get update && \ + apt-get install --yes --force-yes \ + cron g++ gettext libicu-dev openssl \ + libc-client-dev libkrb5-dev \ + libxml2-dev libfreetype6-dev \ + libgd-dev libmcrypt-dev bzip2 \ + libbz2-dev libtidy-dev libcurl4-openssl-dev \ + libz-dev libmemcached-dev libxslt-dev git-core libpq-dev \ + libzip4 libzip-dev libwebp-dev + + +# PHP Configuration +RUN docker-php-ext-install bcmath bz2 calendar dba exif gettext iconv intl soap tidy xsl zip&&\ + docker-php-ext-install mysqli pgsql pdo pdo_mysql pdo_pgsql &&\ + docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp &&\ + docker-php-ext-install gd &&\ + docker-php-ext-configure imap --with-kerberos --with-imap-ssl &&\ + docker-php-ext-install imap &&\ + docker-php-ext-configure hash --with-mhash &&\ + pecl install xdebug && docker-php-ext-enable xdebug &&\ + pecl install mongodb && docker-php-ext-enable mongodb &&\ + pecl install redis && docker-php-ext-enable redis + +# 2. set up document root for apache +COPY docker/apache/000-default.conf /etc/apache2/sites-available/000-default.conf + +# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin- +RUN a2enmod rewrite headers + +# 4. start with base php config, then add extensions +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" + +# 5. Composer +RUN curl -sS https://getcomposer.org/installer | php +RUN mv composer.phar /usr/local/bin/composer +RUN chmod +x /usr/local/bin/composer +RUN composer self-update + +COPY / /var/www/html/ +# 6. we need a user with the same UID/GID with host user +# so when we execute CLI commands, all the host file's ownership remains intact +# otherwise command from inside container will create root-owned files and directories +ARG uid=1000 +RUN useradd -G www-data,root -u $uid -d /home/devuser devuser +RUN mkdir -p /home/devuser/.composer && \ + chown -R devuser:devuser /home/devuser + +RUN composer install + +EXPOSE 80 \ No newline at end of file