Skip to content
30 changes: 28 additions & 2 deletions .docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM nginx:alpine

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

COPY nginx.conf /etc/nginx/
COPY nginx/nginx.conf /etc/nginx/

RUN apk update \
&& apk upgrade \
Expand All @@ -24,8 +24,34 @@ RUN touch /var/log/messages
RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
&& rm /etc/nginx/conf.d/default.conf

ADD ./startup.sh /opt/startup.sh
ADD nginx/startup.sh /opt/startup.sh
RUN sed -i 's/\r//g' /opt/startup.sh

# Add InvoicePlane banner to bash profile
COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh
RUN chmod +x /root/invoiceplane-banner.sh && \
echo "" >> /root/.bashrc && \
echo "# Set container type for banner" >> /root/.bashrc && \
echo "export CONTAINER_TYPE='Nginx Container'" >> /root/.bashrc && \
echo "# Load InvoicePlane Banner" >> /root/.bashrc && \
echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /root/.bashrc && \
echo " source ~/invoiceplane-banner.sh" >> /root/.bashrc && \
echo "fi" >> /root/.bashrc && \
# Also add banner for www-data user \
mkdir -p /home/www-data && \
cp /root/invoiceplane-banner.sh /home/www-data/invoiceplane-banner.sh && \
chown www-data:www-data /home/www-data/invoiceplane-banner.sh && \
chmod +x /home/www-data/invoiceplane-banner.sh && \
touch /home/www-data/.bashrc && \
chown www-data:www-data /home/www-data/.bashrc && \
echo "" >> /home/www-data/.bashrc && \
echo "# Set container type for banner" >> /home/www-data/.bashrc && \
echo "export CONTAINER_TYPE='Nginx Container'" >> /home/www-data/.bashrc && \
echo "# Load InvoicePlane Banner" >> /home/www-data/.bashrc && \
echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /home/www-data/.bashrc && \
echo " source ~/invoiceplane-banner.sh" >> /home/www-data/.bashrc && \
echo "fi" >> /home/www-data/.bashrc

CMD ["/bin/bash", "/opt/startup.sh"]

EXPOSE 80 81 443
10 changes: 5 additions & 5 deletions .docker/php-fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
;fi

# Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY php-fpm/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /usr/local/etc/php/conf.d/xdebug.ini && \
Expand Down Expand Up @@ -690,7 +690,7 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
;fi

# Copy opcache configration
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY php-fpm/opcache.ini /usr/local/etc/php/conf.d/opcache.ini

###########################################################################
# Mysqli Modifications:
Expand Down Expand Up @@ -1368,8 +1368,8 @@ RUN set -xe; php -v | grep -q "PHP ${IVPLDOCK_PHP_VERSION}."
#--------------------------------------------------------------------------
#

COPY ./laravel.ini /usr/local/etc/php/conf.d
COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
COPY php-fpm/laravel.ini /usr/local/etc/php/conf.d
COPY php-fpm/xlaravel.pool.conf /usr/local/etc/php-fpm.d/

USER root

Expand Down Expand Up @@ -1400,7 +1400,7 @@ ENV LC_ALL ${LOCALE}
RUN echo "php_admin_value[memory_limit] = 1024M" >> /usr/local/etc/php-fpm.d/www.conf

# Add InvoicePlane banner to bash profile
COPY ../invoiceplane-banner.sh /root/invoiceplane-banner.sh
COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh
RUN chmod +x /root/invoiceplane-banner.sh && \
echo "" >> /root/.bashrc && \
echo "# Set container type for banner" >> /root/.bashrc && \
Expand Down
26 changes: 25 additions & 1 deletion .docker/php-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,31 @@ RUN set -eux; \
# Make sure you rebuild your container with every change.
#

COPY supervisord.conf /etc/supervisord.conf
COPY php-worker/supervisord.conf /etc/supervisord.conf

# Add InvoicePlane banner to bash profile
COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh
RUN chmod +x /root/invoiceplane-banner.sh && \
echo "" >> /root/.bashrc && \
echo "# Set container type for banner" >> /root/.bashrc && \
echo "export CONTAINER_TYPE='PHP Worker Container'" >> /root/.bashrc && \
echo "# Load InvoicePlane Banner" >> /root/.bashrc && \
echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /root/.bashrc && \
echo " source ~/invoiceplane-banner.sh" >> /root/.bashrc && \
echo "fi" >> /root/.bashrc && \
# Also add banner for laradock user \
cp /root/invoiceplane-banner.sh /home/laradock/invoiceplane-banner.sh && \
chown laradock:laradock /home/laradock/invoiceplane-banner.sh && \
chmod +x /home/laradock/invoiceplane-banner.sh && \
touch /home/laradock/.bashrc && \
chown laradock:laradock /home/laradock/.bashrc && \
echo "" >> /home/laradock/.bashrc && \
echo "# Set container type for banner" >> /home/laradock/.bashrc && \
echo "export CONTAINER_TYPE='PHP Worker Container'" >> /home/laradock/.bashrc && \
echo "# Load InvoicePlane Banner" >> /home/laradock/.bashrc && \
echo "if [ -f ~/invoiceplane-banner.sh ]; then" >> /home/laradock/.bashrc && \
echo " source ~/invoiceplane-banner.sh" >> /home/laradock/.bashrc && \
echo "fi" >> /home/laradock/.bashrc

ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]

Expand Down
26 changes: 13 additions & 13 deletions .docker/workspace/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

USER root

COPY ./aliases.sh /root/aliases.sh
COPY ./aliases.sh /home/ivpldock/aliases.sh
COPY ../invoiceplane-banner.sh /root/invoiceplane-banner.sh
COPY ../invoiceplane-banner.sh /home/ivpldock/invoiceplane-banner.sh
COPY workspace/aliases.sh /root/aliases.sh
COPY workspace/aliases.sh /home/ivpldock/aliases.sh
COPY invoiceplane-banner.sh /root/invoiceplane-banner.sh
COPY invoiceplane-banner.sh /home/ivpldock/invoiceplane-banner.sh

RUN sed -i 's/\r//' /root/aliases.sh && \
sed -i 's/\r//' /home/ivpldock/aliases.sh && \
Expand Down Expand Up @@ -155,10 +155,10 @@ RUN echo "" >> ~/.bashrc && \
USER root

# Add the composer.json
COPY ./composer.json /home/ivpldock/.composer/composer.json
COPY workspace/composer.json /home/ivpldock/.composer/composer.json

# Add the auth.json for magento 2 credentials
COPY ./auth.json /home/ivpldock/.composer/auth.json
COPY workspace/auth.json /home/ivpldock/.composer/auth.json

# Make sure that ~/.composer belongs to ivpldock
RUN chown -R ivpldock:ivpldock /home/ivpldock/.composer
Expand Down Expand Up @@ -220,7 +220,7 @@ RUN echo "" >> ~/.bashrc && \

USER root

COPY ./crontab /etc/cron.d
COPY workspace/crontab /etc/cron.d

RUN chmod -R 644 /etc/cron.d

Expand Down Expand Up @@ -329,7 +329,7 @@ RUN echo "##### PHP Version #####" \
"##### /PHP Version #####"

# ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini
COPY workspace/xdebug.ini /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini

RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ] || { [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && { [ $(php -r "echo PHP_MINOR_VERSION;") = "4" ] || [ $(php -r "echo PHP_MINOR_VERSION;") = "3" ] ;} ;}; then \
sed -i "s/xdebug.remote_host=/xdebug.client_host=/" /etc/php/${IVPLDOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
Expand Down Expand Up @@ -470,8 +470,8 @@ RUN find $NVM_DIR -type f -name node -exec ln -s {} /usr/local/bin/node \; && \
ln -s $NODE_MODS_DIR/npm/bin/npx-cli.js /usr/local/bin/npx

# Mount .npmrc into home folder
COPY ./.npmrc /root/.npmrc
COPY ./.npmrc /home/${IVPLDOCK_USER}/.npmrc
COPY workspace/.npmrc /root/.npmrc
COPY workspace/.npmrc /home/${IVPLDOCK_USER}/.npmrc

###########################################################################
# YARN:
Expand Down Expand Up @@ -633,7 +633,7 @@ RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \

ARG INSTALL_GIT_PROMPT=false

COPY git-prompt.sh /tmp/git-prompt
COPY workspace/git-prompt.sh /tmp/git-prompt

RUN if [ ${INSTALL_GIT_PROMPT} = true ]; then \
git clone https://github.com/magicmonty/bash-git-prompt.git /root/.bash-git-prompt --depth=1 && \
Expand Down Expand Up @@ -701,8 +701,8 @@ USER root

USER root

COPY ./aliases.sh /root/aliases.sh
COPY ./aliases.sh /home/ivpldock/aliases.sh
COPY workspace/aliases.sh /root/aliases.sh
COPY workspace/aliases.sh /home/ivpldock/aliases.sh

RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \
sed -i 's/\r//' /root/aliases.sh && \
Expand Down
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ services:
### Workspace Utilities ##################################
workspace:
build:
context: ./.docker/workspace
context: ./.docker
dockerfile: workspace/Dockerfile
args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH}
Expand Down Expand Up @@ -175,7 +176,8 @@ services:
### PHP-FPM ##############################################
php-fpm:
build:
context: ./.docker/php-fpm
context: ./.docker
dockerfile: php-fpm/Dockerfile
args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- BASE_IMAGE_TAG_PREFIX=${PHP_FPM_BASE_IMAGE_TAG_PREFIX}
Expand Down Expand Up @@ -288,7 +290,8 @@ services:
### PHP Worker ############################################
php-worker:
build:
context: ./.docker/php-worker
context: ./.docker
dockerfile: php-worker/Dockerfile
args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- IVPLDOCK_PHP_VERSION=${PHP_VERSION}
Expand Down Expand Up @@ -346,7 +349,8 @@ services:
### NGINX Server #########################################
nginx:
build:
context: ./.docker/nginx
context: ./.docker
dockerfile: nginx/Dockerfile
args:
- CHANGE_SOURCE=${CHANGE_SOURCE}
- PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
Expand Down