Last active
March 3, 2022 12:42
-
-
Save Nightbr/914b1f0838b8fd7a10663d6285116f12 to your computer and use it in GitHub Desktop.
FusionInvoice Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.tmp | |
.git | |
docker-compose.yml | |
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace FI\Providers; | |
use FI\Support\Directory; | |
use Illuminate\Support\Facades\File; | |
use Illuminate\Routing\UrlGenerator; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot(UrlGenerator $url) | |
{ | |
if (config('app.https') == 'true') { | |
$url->forceSchema('https'); | |
} | |
if (config('proxies.trust_all')) { | |
request()->setTrustedProxies([request()->getClientIp()]); | |
} | |
if (!$this->app->environment('testing') and $this->app->config->get('app.key') == 'ReplaceThisWithYourOwnLicenseKey') { | |
die('You must enter your license key in config/app.php to continue.'); | |
} | |
$this->app->view->addLocation(base_path('custom/overrides')); | |
$modules = Directory::listDirectories(app_path('Modules')); | |
foreach ($modules as $module) { | |
$routesPath = app_path('Modules/' . $module . '/routes.php'); | |
$viewsPath = app_path('Modules/' . $module . '/Views'); | |
if (file_exists($routesPath)) { | |
require $routesPath; | |
} | |
if (file_exists($viewsPath)) { | |
$this->app->view->addLocation($viewsPath); | |
} | |
} | |
foreach (File::files(app_path('Helpers')) as $helper) { | |
require_once $helper; | |
} | |
$this->app->view->addLocation(base_path('custom/templates')); | |
$this->app->view->addLocation(storage_path()); | |
$this->app->register('FI\Providers\AddonServiceProvider'); | |
$this->app->register('FI\Providers\ComposerServiceProvider'); | |
$this->app->register('FI\Providers\ConfigServiceProvider'); | |
$this->app->register('FI\Providers\DashboardWidgetServiceProvider'); | |
$this->app->register('FI\Providers\EventServiceProvider'); | |
$this->app->register('Collective\Html\HtmlServiceProvider'); | |
} | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
|-------------------------------------------------------------------------- | |
| Application URL | |
|-------------------------------------------------------------------------- | |
| | |
| This URL is used by the console to properly generate URLs when using | |
| the Artisan command line tool. You should set this to the root of | |
| your application so that it is used when running Artisan tasks. | |
| | |
*/ | |
'url' => getenv('APPHOST'), | |
'https' => getenv('APPHTTPS'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 9 * * * root curl http://localhost/tasks/run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
### Applications Code Container ############################# | |
app: | |
build: | |
context: . | |
ports: | |
- 8000:80 | |
environment: | |
- APPHOST=http://localhost:8000 | |
- APPHTTPS=false | |
- DATABASE_NAME=fusioninvoice | |
- DATABASE_USERNAME=fusioninvoice | |
- DATABASE_PASSWORD=fusioninvoice | |
volumes: | |
- .tmp/storage:/var/www/html/storage:rw | |
- .tmp/custom:/var/www/html/custom:rw | |
networks: | |
- backend | |
### Database Container ###################################### | |
mysql: | |
image: mysql | |
environment: | |
- MYSQL_DATABASE=fusioninvoice | |
- MYSQL_USER=fusioninvoice | |
- MYSQL_PASSWORD=fusioninvoice | |
- MYSQL_ROOT_PASSWORD=password | |
volumes: | |
- .tmp/mysql:/var/lib/mysql | |
networks: | |
- backend | |
### Networks Setup ############################################ | |
networks: | |
backend: | |
driver: "bridge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.1-apache | |
MAINTAINER Titouan BENOIT <[email protected]> | |
ENV APPHOST http://localhost:8000 | |
ENV APPHTTPS false | |
ENV DATABASE_NAME fusioninvoice | |
ENV DATABASE_USERNAME fusioninvoice | |
ENV DATABASE_PASSWORD fusioninvoice | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
curl \ | |
cron \ | |
libz-dev \ | |
libssl-dev \ | |
libxml2-dev \ | |
libmcrypt-dev | |
# Install gd | |
RUN apt-get install -y \ | |
libfreetype6-dev \ | |
libjpeg62-turbo-dev \ | |
libpng12-dev \ | |
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
&& docker-php-ext-install gd | |
# Install the PHP mcrypt extention | |
RUN docker-php-ext-install mcrypt | |
# Install mbstring | |
RUN docker-php-ext-install mbstring | |
# Install xml | |
RUN docker-php-ext-install xml | |
# Install fileinfo | |
RUN docker-php-ext-install fileinfo | |
# Install the PHP pdo_mysql extention | |
RUN docker-php-ext-install mysqli \ | |
&& docker-php-ext-install pdo_mysql | |
# Install zip | |
RUN apt-get install -y \ | |
zlib1g-dev \ | |
&& docker-php-ext-install zip | |
# Copy app code | |
COPY . /var/www/html/ | |
# Copy error for DEBUG | |
COPY error.ini /usr/local/etc/php/conf.d/ | |
# Back custom folder | |
RUN cp -r /var/www/html/custom /var/www/html/custom_back | |
# Configure cron job | |
# Add crontab file in the cron directory | |
RUN crontab /var/www/html/crontab | |
# Create the log file to be able to run tail | |
RUN touch /var/log/cron.log | |
# Reload cron | |
RUN service cron reload | |
# Enable Apache mod_rewrite | |
RUN a2enmod rewrite | |
# Change Apache User | |
ENV APACHE_RUN_USER www-data | |
ENV APACHE_RUN_GROUP www-data | |
ENV APACHE_LOG_DIR /var/log/apache2 | |
ENV APACHE_LOCK_DIR /var/lock/apache2 | |
ENV APACHE_PID_FILE /var/run/apache2.pid | |
# Bind Apache User with our User | |
RUN usermod --non-unique --uid 1000 www-data | |
RUN groupmod --non-unique --gid 1000 www-data | |
VOLUME ["/var/www/html/storage", "/var/www/html/custom"] | |
CMD /var/www/html/init_storage.sh; cron; apache2-foreground | |
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_errors = On | |
error_log = /dev/stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 'Create storage directory' | |
mkdir -p /var/www/html/storage/app | |
mkdir -p /var/www/html/storage/debugbar | |
mkdir -p /var/www/html/storage/framework/cache | |
mkdir -p /var/www/html/storage/framework/sessions | |
mkdir -p /var/www/html/storage/framework/views | |
mkdir -p /var/www/html/storage/logs | |
#chmod 777 -R /var/www/html/storage | |
#chmod 777 -R /var/www/html/bootstrap/cache | |
# Manage custom folder | |
if [ "$(ls -A /var/www/html/custom)" ]; then | |
echo "Custom Already init: you can use volume to edit custom templates" | |
else | |
cp -r /var/www/html/custom_back/* /var/www/html/custom | |
fi | |
# Set permission for user | |
chown -R www-data:www-data /var/www/html/ |
Hi! Trying to dockerize FusionInvoice I've found your gist.
How does it works?
Does it refer to specific version of the product?
I think I'm using 2018-5.
Best,
JonyR
Hey, It was for 2018-7 version. It works as describe, put files with the source code and execute command to build the docker containers.
I'll try! Thanks so much.
Any improvements I can make to the container I will share with you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put at root of FusionInvoice:
and in app/config.php add
Run
docker-compose up -d
to start the stack.To rebuild image and stack run
docker-compose up --build -d
Customize with your env on the docker-compose.
Known issues:
chmod +x init_storage.sh
app/Providers/AppServiceProvider.php
in gistAPPHTTPS
env totrue