forked from Dolibarr/dolibarr-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f33835
commit 279657f
Showing
5 changed files
with
601 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
ARG ARCH= | ||
|
||
# Use an image like PHP_BASE_IMAGE=x.y-apache-buster | ||
FROM ${ARCH}php:8.2-apache-buster | ||
|
||
# Credit/Initial maintainer: Garcia MICHEL <[email protected]> | ||
# Modified according to the GPL license by developers of the Dolibarr community: | ||
# 2024 Alois Micard | ||
# 2024 Laurent Destailleur | ||
LABEL maintainer="The Dolibarr foundation <[email protected]>" | ||
|
||
ENV DOLI_VERSION 20.0.0 | ||
ENV DOLI_VERSION_FOR_INIT_DEMO 20.0 | ||
ENV DOLI_INSTALL_AUTO 1 | ||
ENV DOLI_PROD 1 | ||
|
||
ENV DOLI_DB_TYPE mysqli | ||
ENV DOLI_DB_HOST mysql | ||
ENV DOLI_DB_HOST_PORT 3306 | ||
ENV DOLI_DB_NAME dolidb | ||
|
||
ENV DOLI_URL_ROOT 'http://localhost' | ||
ENV DOLI_NOCSRFCHECK 0 | ||
|
||
ENV DOLI_AUTH dolibarr | ||
ENV DOLI_LDAP_HOST 127.0.0.1 | ||
ENV DOLI_LDAP_PORT 389 | ||
ENV DOLI_LDAP_VERSION 3 | ||
ENV DOLI_LDAP_SERVER_TYPE openldap | ||
ENV DOLI_LDAP_LOGIN_ATTRIBUTE uid | ||
ENV DOLI_LDAP_DN 'ou=users,dc=my-domain,dc=com' | ||
ENV DOLI_LDAP_FILTER '' | ||
ENV DOLI_LDAP_BIND_DN '' | ||
ENV DOLI_LDAP_BIND_PASS '' | ||
ENV DOLI_LDAP_DEBUG false | ||
|
||
ENV DOLI_CRON 0 | ||
|
||
ENV WWW_USER_ID 33 | ||
ENV WWW_GROUP_ID 33 | ||
|
||
ENV PHP_INI_DATE_TIMEZONE 'UTC' | ||
ENV PHP_INI_MEMORY_LIMIT 256M | ||
ENV PHP_INI_UPLOAD_MAX_FILESIZE 20M | ||
ENV PHP_INI_POST_MAX_SIZE 22M | ||
ENV PHP_INI_ALLOW_URL_FOPEN 0 | ||
|
||
RUN sed -i \ | ||
-e 's/^\(ServerSignature On\)$/#\1/g' \ | ||
-e 's/^#\(ServerSignature Off\)$/\1/g' \ | ||
-e 's/^\(ServerTokens\) OS$/\1 Prod/g' \ | ||
/etc/apache2/conf-available/security.conf | ||
|
||
RUN apt-get update -y \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
libc-client-dev \ | ||
libfreetype6-dev \ | ||
libjpeg62-turbo-dev \ | ||
libkrb5-dev \ | ||
libldap2-dev \ | ||
libpng-dev \ | ||
libpq-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
default-mysql-client \ | ||
postgresql-client \ | ||
vim-tiny \ | ||
cron \ | ||
&& apt-get autoremove -y \ | ||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \ | ||
&& docker-php-ext-configure pgsql -with-pgsql \ | ||
&& docker-php-ext-install pdo_pgsql pgsql \ | ||
&& docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ \ | ||
&& docker-php-ext-install -j$(nproc) ldap \ | ||
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ | ||
&& docker-php-ext-install imap \ | ||
&& mv ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Get Dolibarr | ||
RUN curl -fLSs https://github.com/Dolibarr/dolibarr/archive/${DOLI_VERSION}.tar.gz |\ | ||
tar -C /tmp -xz && \ | ||
cp -r /tmp/dolibarr-${DOLI_VERSION}/htdocs/* /var/www/html/ && \ | ||
ln -s /var/www/html /var/www/htdocs && \ | ||
cp -r /tmp/dolibarr-${DOLI_VERSION}/scripts /var/www/ && \ | ||
rm -rf /tmp/* && \ | ||
mkdir -p /var/www/documents && \ | ||
mkdir -p /var/www/html/custom && \ | ||
chown -R www-data:www-data /var/www | ||
|
||
EXPOSE 80 | ||
VOLUME /var/www/documents | ||
VOLUME /var/www/html/custom | ||
|
||
COPY docker-init.php /var/www/scripts/ | ||
COPY docker-run.sh /usr/local/bin/ | ||
ENTRYPOINT ["docker-run.sh"] | ||
|
||
CMD ["apache2-foreground"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
# This script is called by the docker-run.sh script to enabled modules during Dolibarr first installation. | ||
# It is embedded into the Docker image of dolibarr/dolibarr. | ||
|
||
require_once '../htdocs/master.inc.php'; | ||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; | ||
|
||
printf("Activating module User... "); | ||
activateModule('modUser'); | ||
printf("OK\n"); | ||
|
||
if (!empty(getenv('DOLI_COMPANY_COUNTRYCODE'))) { | ||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; | ||
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; | ||
$countryCode = getenv('DOLI_COMPANY_COUNTRYCODE'); | ||
$country = new Ccountry($db); | ||
$res = $country->fetch(0,$countryCode); | ||
if ($res > 0 ) { | ||
$s = $country->id.':'.$country->code.':'.$country->label; | ||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s, 'chaine', 0, '', $conf->entity); | ||
printf('Configuring for country : '.$s."\n"); | ||
activateModulesRequiredByCountry($country->code); | ||
} else { | ||
printf('Unable to find country '.$countryCode."\n"); | ||
} | ||
} | ||
|
||
if (!empty(getenv('DOLI_COMPANY_NAME'))) { | ||
$compname = getenv('DOLI_COMPANY_NAME'); | ||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", $compname, 'chaine', 0, '', $conf->entity); | ||
} | ||
|
||
if (!empty(getenv('DOLI_ENABLE_MODULES'))) { | ||
$mods = explode(',', getenv('DOLI_ENABLE_MODULES')); | ||
foreach ($mods as $mod) { | ||
printf("Activating module ".$mod." ..."); | ||
try { | ||
$res = activateModule('mod' . $mod); | ||
if ($res < 0) { | ||
print(" FAILED. Unable to load module. Be sure to check the case\n"); | ||
} else { | ||
printf(" OK\n"); | ||
} | ||
} catch (Throwable $t) { | ||
print(" FAILED. Unable to load module. Be sure to check the case\n"); | ||
} | ||
} | ||
} |
Oops, something went wrong.