Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions .docker/Dockerfile.apache
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ FROM php:8.1-apache
LABEL vendor="Mautic"
LABEL maintainer="LibreCode coop"

# hadolint ignore=DL3008
RUN apt-get update && apt-get install --no-install-recommends -y \
git \
mariadb-client supervisor cron
git \
mariadb-client supervisor cron && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install PHP extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
Expand All @@ -27,8 +30,6 @@ RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \
zip \
xdebug

RUN echo "memory_limit = -1" > /usr/local/etc/php/php.ini

RUN rm /etc/cron.daily/*

# Setting PHP properties
Expand All @@ -43,11 +44,9 @@ COPY ./scripts/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini

ENV APACHE_DOCUMENT_ROOT=/var/www/html/docroot

RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

# Enable Apache Rewrite Module
RUN a2enmod rewrite
RUN sed -ri -e "s!/var/www/html!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/sites-available/*.conf && \
sed -ri -e "s!/var/www/!${APACHE_DOCUMENT_ROOT}!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
a2enmod rewrite

COPY ./scripts/docker-entrypoint.sh /entrypoint.sh
COPY ./scripts/entrypoint_mautic_web.sh /entrypoint_mautic_web.sh
Expand All @@ -68,12 +67,14 @@ ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \
# Install NVM
ENV NVM_DIR=/usr/local/nvm \
NODE_VERSION=20.18.1
RUN mkdir -p /usr/local/nvm \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=SC1091
RUN mkdir -p /usr/local/nvm && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash && \
. "$NVM_DIR/nvm.sh" && \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default

COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

Expand Down
23 changes: 13 additions & 10 deletions .docker/Dockerfile.fpm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ FROM php:8.1-fpm
LABEL vendor="Mautic"
LABEL maintainer="LibreCode coop"

# hadolint ignore=DL3008
RUN apt-get update && apt-get install --no-install-recommends -y \
git \
mariadb-client supervisor cron
git \
mariadb-client supervisor cron && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install PHP extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
Expand All @@ -27,8 +30,6 @@ RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \
zip \
xdebug

RUN echo "memory_limit = -1" > /usr/local/etc/php/php.ini

RUN rm /etc/cron.daily/*

# Setting PHP properties
Expand Down Expand Up @@ -60,12 +61,14 @@ ENV DOCKER_MAUTIC_WORKERS_CONSUME_EMAIL=2 \
# Install NVM
ENV NVM_DIR=/usr/local/nvm \
NODE_VERSION=20.18.1
RUN mkdir -p /usr/local/nvm \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=SC1091
RUN mkdir -p /usr/local/nvm && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash && \
. "$NVM_DIR/nvm.sh" && \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default

COPY ./scripts/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

Expand Down
13 changes: 7 additions & 6 deletions .docker/scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ elif [ "$DOCKER_MAUTIC_ROLE" = "mautic_cron" ]; then
/entrypoint_mautic_cron.sh
elif [ "$DOCKER_MAUTIC_ROLE" = "mautic_web" ]; then
if [ ! -f /var/www/html/composer.json ]; then
# shellcheck disable=SC1091
. "$NVM_DIR/nvm.sh"
nvm install $NODE_VERSION
nvm alias default $NODE_VERSION
nvm install "$NODE_VERSION"
nvm alias default "$NODE_VERSION"
nvm use default

cd /var/www
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_PROCESS_TIMEOUT=10000 composer create-project mautic/recommended-project:${MAUTIC_VERSION} html --no-interaction
cd /var/www || { echo "Directory not found /var/www"; exit 1; }
COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_PROCESS_TIMEOUT=10000 composer create-project mautic/recommended-project:"${MAUTIC_VERSION}" html --no-interaction
chown -R www-data: html
cd html
cd html || { echo "Directory not found /var/www/html"; exit 1; }
rm -rf var/cache/js
find node_modules -mindepth 1 -maxdepth 1 -not \( -name 'jquery' -or -name 'vimeo-froogaloop2' \) | xargs rm -rf
find node_modules -mindepth 1 -maxdepth 1 -not \( -name 'jquery' -or -name 'vimeo-froogaloop2' \) -print0 | xargs -0 rm -rf
mkdir -p html/config html/var/logs html/docroot/media
fi
/entrypoint_mautic_web.sh "$@"
Expand Down
1 change: 1 addition & 0 deletions .docker/scripts/entrypoint_mautic_cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ chmod 777 /tmp/stdout
declare -p | grep 'PHP_INI_VALUE_' > /tmp/cron.env

# wait until Mautic is installed
# shellcheck disable=SC2016
until php -r 'file_exists("/var/www/html/config/local.php") ? include("/var/www/html/config/local.php") : exit(1); exit(isset($parameters["site_url"]) ? 0 : 1);'; do
echo "Mautic not installed, waiting to start cron"
sleep 5
Expand Down
2 changes: 1 addition & 1 deletion .docker/scripts/entrypoint_mautic_web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
chown -R www-data:www-data /var/www/html/config /var/www/html/var/logs /var/www/html/docroot/media

# wait untill the db is fully up before proceeding
while [[ $(mysqladmin --host=$MAUTIC_DB_HOST --port=$MAUTIC_DB_PORT --user=$MAUTIC_DB_USER --password=$MAUTIC_DB_PASSWORD ping) != "mysqld is alive" ]]; do
while [[ $(mysqladmin --host="$MAUTIC_DB_HOST" --port="$MAUTIC_DB_PORT" --user="$MAUTIC_DB_USER" --password="$MAUTIC_DB_PASSWORD" ping) != "mysqld is alive" ]]; do
sleep 1
done

Expand Down
1 change: 1 addition & 0 deletions .docker/scripts/entrypoint_mautic_worker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# wait until Mautic is installed
# shellcheck disable=SC2016
until php -r 'file_exists("/var/www/html/config/local.php") ? include("/var/www/html/config/local.php") : exit(1); exit(isset($parameters["site_url"]) ? 0 : 1);'; do
echo "Mautic not installed, waiting to start workers"
sleep 5
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/hlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Dockerfile Lint

on: pull_request

jobs:
hlint:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HLINT_ACTION_LOG_LEVEL: debug
steps:
- name: Check out
uses: actions/checkout@v4

- name: Lint Apache Dockerfille
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: .docker/Dockerfile.apache
format: sarif
output-file: hadolint-apache-results.sarif
no-fail: true

- name: Lint FPM Dockerfille
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: .docker/Dockerfile.fpm
format: sarif
output-file: hadolint-fpm-results.sarif
no-fail: true

- name: Upload Apache analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: hadolint-apache-results.sarif
wait-for-processing: true
category: hadolint-apache

- name: Upload FPM analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: hadolint-fpm-results.sarif
wait-for-processing: true
category: hadolint-fpm
10 changes: 3 additions & 7 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
on:
pull_request:
push:
branches:
- main
name: Shellcheck

name: 'Shellcheck'
on: pull_request

jobs:
shellcheck:
Expand All @@ -15,4 +11,4 @@ jobs:
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: .docker/
scandir: .docker/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.env
/volumes/
volumes
/.vscode
8 changes: 4 additions & 4 deletions examples/rabbitmq-worker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ x-mautic-environments: &mautic-environments
MAUTIC_DB_NAME: ${MAUTIC_DB_NAME:-mautic}
MAUTIC_RUN_CRON_JOBS: ${MAUTIC_RUN_CRON_JOBS:-true}
XDEBUG_CONFIG: ${XDEBUG_CONFIG:-}
MAUTIC_MESSENGER_DSN_EMAIL: ${MAUTIC_MESSENGER_DSN_EMAIL:-amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672/mautic/messages}
MAUTIC_MESSENGER_DSN_HIT: ${MAUTIC_MESSENGER_DSN_HIT:-amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672/mautic/messages}
MAUTIC_MESSENGER_DSN_EMAIL: ${MAUTIC_MESSENGER_DSN_EMAIL:-amqp://${RABBITMQ_DEFAULT_USER:-guest}:${RABBITMQ_DEFAULT_PASS:-guest}@rabbitmq:5672${RABBITMQ_DEFAULT_VHOST:-rabbitmq}}
MAUTIC_MESSENGER_DSN_HIT: ${MAUTIC_MESSENGER_DSN_HIT:-amqp://${RABBITMQ_DEFAULT_USER:-guest}:${RABBITMQ_DEFAULT_PASS:-guest}@rabbitmq:5672${RABBITMQ_DEFAULT_VHOST:-rabbitmq}}

services:
mysql:
Expand Down Expand Up @@ -91,8 +91,8 @@ services:
image: rabbitmq:4
environment:
- RABBITMQ_DEFAULT_VHOST=${RABBITMQ_DEFAULT_VHOST:-rabbitmq}
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-rabbitmq}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-rabbitmq}
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-guest}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-guest}
volumes:
- ./volumes/rabbitmq/data:/var/lib/rabbitmq
- .docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
Expand Down
Loading