Merge pull request #14660 from FHenry/dev_updatedocker

Update Docker build to new standard (version 3 of docker-compose)
This commit is contained in:
Laurent Destailleur 2020-09-09 15:26:06 +02:00 committed by GitHub
commit e439eb636e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 98 additions and 58 deletions

View File

@ -1,38 +1,50 @@
FROM php:7.2-apache FROM php:7.3-apache
ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M
RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\ RUN apt-get update -y \
&& rm -rf /var/lib/apt/lists/* \ && apt-get install -y --no-install-recommends \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ libfreetype6-dev \
&& docker-php-ext-install gd \ libjpeg62-turbo-dev \
&& docker-php-ext-install zip \ libjpeg62-turbo \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ libpng-dev \
&& docker-php-ext-install ldap \ libpng16-16 \
&& docker-php-ext-install mysqli \ libldap2-dev \
&& docker-php-ext-install calendar \ libxml2-dev \
&& docker-php-ext-configure intl \ libzip-dev \
&& docker-php-ext-install intl \ zlib1g-dev \
&& apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++ libicu-dev \
g++ \
default-mysql-client \
unzip \
curl \
apt-utils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \
mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini
RUN mkdir /var/documents RUN mkdir /var/documents
RUN chown www-data /var/documents RUN chown www-data:www-data /var/documents
COPY docker-run.sh /usr/local/bin/ COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug && docker-php-ext-enable xdebug RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_host=docker.host' >> /usr/local/etc/php/php.ini #RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
RUN echo '172.17.0.1 docker.host' >> /etc/hosts #RUN echo '172.17.0.1 docker.host' >> /etc/hosts
EXPOSE 80 EXPOSE 80

View File

@ -1,6 +1,8 @@
# How to use it ? # How to use it ?
The docker-compose.yml file is used to build and run Dolibarr in the current workspace. The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
This docker image intended for developpement usage.
For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr
Before build/run, define the variable HOST_USER_ID as following: Before build/run, define the variable HOST_USER_ID as following:
@ -26,3 +28,4 @@ The URL to go to PhpMyAdmin is (login/password is root/root) :
Setup the database connection during the installation process, please use mariad Setup the database connection during the installation process, please use mariad
b (name of the database container) as database host. b (name of the database container) as database host.
Setup documents folder, during the installation process, to /var/documents

View File

@ -1,32 +1,51 @@
mariadb: version: '3'
build: mariadb
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dolibarr
phpmyadmin: networks:
image: phpmyadmin/phpmyadmin internal-pod:
environment: internal: true
PMA_HOST: mariadb external-pod:
links: internal: false
- mariadb
ports:
- "8080:80"
web: services:
build: . mariadb:
environment: image: mariadb:latest
HOST_USER_ID: $HOST_USER_ID environment:
volumes: MYSQL_ROOT_PASSWORD: root
- ../../htdocs:/var/www/html MYSQL_DATABASE: dolibarr
links: networks:
- mariadb - internal-pod
- mail
ports:
- "80:80"
mail: phpmyadmin:
image: maildev/maildev image: phpmyadmin/phpmyadmin
ports: environment:
- "8081:80" PMA_HOST: mariadb
- "25:25" depends_on:
- mariadb
ports:
- "8080:80"
networks:
- internal-pod
- external-pod
web:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
volumes:
- ../../htdocs:/var/www/html/
- ../../documents:/var/documents
ports:
- "80:80"
- "9000:9000"
depends_on:
- mariadb
- mail
networks:
- internal-pod
- external-pod
mail:
image: maildev/maildev
ports:
- "8081:80"
- "25:25"

View File

@ -1,15 +1,21 @@
#!/bin/bash #!/bin/bash
usermod -u $HOST_USER_ID www-data usermod -u ${HOST_USER_ID} www-data
groupmod -g $HOST_USER_ID www-data groupmod -g ${HOST_USER_ID} www-data
chgrp -hR www-data /var/www/html chgrp -hR www-data /var/www/html
chmod g+rwx /var/www/html/conf chmod g+rwx /var/www/html/conf
if [ ! -d /var/documents ]; then
echo "[docker-run] => create volume directory /var/documents ..."
mkdir -p /var/documents
fi
echo "[docker-run] => Set Permission to www-data for /var/documents"
chown -R www-data:www-data /var/documents
if [ ! -f /usr/local/etc/php/php.ini ]; then if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE date.timezone = $PHP_INI_DATE_TIMEZONE
display_errors = On
EOF EOF
fi fi

View File

@ -23,5 +23,5 @@ ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_rec
ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid); ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid);
--ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid); -- ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid);