diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4d7c86f..5ce5785 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -184,3 +184,46 @@ jobs: PHP_VARIANT: ${{ matrix.php_variant }} INDEV_FLAG: ${{ github.ref == 'refs/heads/main' && '0' || '1' }} run: bash scripts/build.sh "${BUILD_GROUP}" + + orocommerce: + name: Build Warden PHP-FPM Images ${{ matrix.php_version }} (OroCommerce) + runs-on: ubuntu-latest + # needs: php-fpm + strategy: + matrix: + php_version: ["8.2", "8.3"] + php_variant: ["fpm-loaders"] + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build & Push Images + env: + BUILD_GROUP: php-fpm/orocommerce + PRE_AUTH: 1 + WARDEN_IMAGE_REPOSITORY: ghcr.io/wardenenv + PHP_SOURCE_IMAGE: ghcr.io/wardenenv/centos-php + PUSH_FLAG: 1 + PHP_VERSION: ${{ matrix.php_version }} + PHP_VARIANT: ${{ matrix.php_variant }} + INDEV_FLAG: 0 # ${{ github.ref == 'refs/heads/main' && '0' || '1' }} + run: bash scripts/build.sh "${BUILD_GROUP}" + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build & Push Images (Docker Hub) + env: + BUILD_GROUP: php-fpm/orocommerce + PRE_AUTH: 1 + PHP_SOURCE_IMAGE: ghcr.io/wardenenv/centos-php + PUSH_FLAG: 1 + PHP_VERSION: ${{ matrix.php_version }} + PHP_VARIANT: ${{ matrix.php_variant }} + INDEV_FLAG: ${{ github.ref == 'refs/heads/main' && '0' || '1' }} + run: bash scripts/build.sh "${BUILD_GROUP}" \ No newline at end of file diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index ac4c8a7..f32add0 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -17,11 +17,23 @@ jobs: fail-fast: false matrix: version: - - "16" + - "12.19" + - "13.15" + - "14.12" - "15" - - "14" - - "13" - - "12" + - "15.0" + - "15.1" + - "15.2" + - "15.3" + - "15.4" + - "15.5" + - "15.6" + - "15.7" + - "16" + - "16.0" + - "16.1" + - "16.2" + - "16.3" steps: - uses: actions/checkout@v3 diff --git a/nginx/etc/nginx/available.d/orocommerce.conf b/nginx/etc/nginx/available.d/orocommerce.conf new file mode 100644 index 0000000..671bd9a --- /dev/null +++ b/nginx/etc/nginx/available.d/orocommerce.conf @@ -0,0 +1,45 @@ +location / { + try_files $uri /index.php$is_args$args; +} + +location ~ ^/(index|index_dev|config|install)\.php(/|$) { + fastcgi_pass $fastcgi_backend; + + fastcgi_split_path_info ^(.+\.php)(/.*)$; + + include fastcgi_params; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param HTTPS on; + fastcgi_buffers 64 64k; + fastcgi_buffer_size 128k; + + internal; +} + +location ~* ^[^(\.php)]+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|bmp|rtf|js)$ { + access_log off; + expires 1h; + add_header Cache-Control public; +} + +gzip on; +gzip_proxied any; +gzip_types + text/plain + text/css + text/js + text/xml + text/javascript + application/javascript + application/x-javascript + application/json + application/xml + application/xml+rss + image/svg+xml; +gzip_vary on; + +# Deny access to other "sensitive" locations / scripts +location ~* (\.php$|\.htaccess$|\.git) { + deny all; +} \ No newline at end of file diff --git a/php-fpm/orocommerce/Dockerfile b/php-fpm/orocommerce/Dockerfile new file mode 100644 index 0000000..70bad3c --- /dev/null +++ b/php-fpm/orocommerce/Dockerfile @@ -0,0 +1,41 @@ +ARG ENV_SOURCE_IMAGE +ARG PHP_VERSION + +FROM ${ENV_SOURCE_IMAGE}:${PHP_VERSION} +ARG PHP_EXTENSIONS="pcntl imap tidy ldap pecl-mongodb" + +USER root + +RUN set -eux \ + && PHP_PACKAGES= && for PKG in ${PHP_EXTENSIONS}; do \ + if [[ ${PKG} = "mcrypt" ]] && (( ${PHP_VERSION} > 71 )); then continue; fi; \ + if [[ ${PKG} = "sodium" ]] && (( ${PHP_VERSION} < 72 )); then continue; fi; \ + PHP_PACKAGES+="php-${PKG} "; \ + done \ + && dnf install -y ${PHP_PACKAGES} jpegoptim pngquant supervisor \ + && dnf clean all \ + && rm -rf /var/cache/dnf \ + && perl -pi -e 's/^(memory_limit)=.*$/$1=1G/g' /etc/php-fpm-fcgi.ini \ + && perl -pi -e 's/^(realpath_cache_size)=.*$/$1=4096K/g' /etc/php-fpm-fcgi.ini \ + && perl -pi -e 's/^(realpath_cache_ttl)=.*$/$1=600/g' /etc/php-fpm-fcgi.ini \ + && perl -pi -e 's/^(opcache\.enable)=.*$/$1=1/g' /etc/php.d/10-opcache.ini \ + && perl -pi -e 's/^(opcache\.enable_cli)=.*$/$1=0/g' /etc/php.d/10-opcache.ini \ + && perl -pi -e 's/^(opcache\.memory_consumption)=.*$/$1=512/g' /etc/php.d/10-opcache.ini \ + && perl -pi -e 's/^(opcache\.interned_strings_buffer)=.*$/$1=32/g' /etc/php.d/10-opcache.ini \ + && perl -pi -e 's/^(opcache\.max_accelerated_files)=.*$/$1=32531/g' /etc/php.d/10-opcache.ini \ + && perl -pi -e 's/^(opcache\.save_comments)=.*$/$1=1/g' /etc/php.d/10-opcache.ini + +RUN mkdir -p /var/log/supervisor \ + && chown www-data:www-data /var/log/supervisor + +COPY oro-init /usr/local/bin/ +COPY etc/php.d/*.ini /etc/php.d/ +COPY etc/supervisord.d/* /etc/supervisord.d/ + +# Disabling Phar extension +RUN sed 's/^\(extension=phar\)/;\1/' /etc/php.d/*-phar.ini + +# Inject the oro customization before starting PHP-FPM +RUN sed -i '/^exec "\$@"/i oro-init\n' /usr/local/bin/docker-entrypoint + +USER www-data diff --git a/php-fpm/orocommerce/blackfire/Dockerfile b/php-fpm/orocommerce/blackfire/Dockerfile new file mode 100644 index 0000000..a962634 --- /dev/null +++ b/php-fpm/orocommerce/blackfire/Dockerfile @@ -0,0 +1,20 @@ +ARG ENV_SOURCE_IMAGE +ARG PHP_VERSION +FROM ${ENV_SOURCE_IMAGE}:${PHP_VERSION}-orocommerce +USER root + +RUN curl -o - "http://packages.blackfire.io/fedora/blackfire.repo" \ + | sudo tee /etc/yum.repos.d/blackfire.repo \ + && dnf install -y blackfire-php \ + && dnf clean all \ + && rm -rf /var/cache/dnf + +# Install the Blackfire Client to provide access to the CLI tool +RUN mkdir -p /tmp/blackfire \ + && curl -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire \ + && mv /tmp/blackfire/blackfire /usr/bin/blackfire \ + && rm -rf /tmp/blackfire + +COPY blackfire/etc/php.d/*.ini /etc/php.d/ + +USER www-data diff --git a/php-fpm/orocommerce/context/etc/php.d/75-oro.ini b/php-fpm/orocommerce/context/etc/php.d/75-oro.ini new file mode 100644 index 0000000..32dcf03 --- /dev/null +++ b/php-fpm/orocommerce/context/etc/php.d/75-oro.ini @@ -0,0 +1,15 @@ +[PHP] +max_execution_time=600 +realpath_cache_size=4096K +realpath_cache_ttl=600 + +[opcache] +opcache.enabled=1 +opcache.enable_cli=1 +opcache.memory_consumption=512 +opcache.interned_strings_buffer=32 +opcache.max_accelerated_files=32531 +opcache.save_comments=1 + +[zend] +zend.detect_unicode=0 \ No newline at end of file diff --git a/php-fpm/orocommerce/context/etc/supervisord.d/oro-message-consumer.ini b/php-fpm/orocommerce/context/etc/supervisord.d/oro-message-consumer.ini new file mode 100644 index 0000000..817e127 --- /dev/null +++ b/php-fpm/orocommerce/context/etc/supervisord.d/oro-message-consumer.ini @@ -0,0 +1,9 @@ +[program:oro_message_consumer] +command=php ./bin/console oro:message-queue:consume --env=prod +process_name=%(program_name)s_%(process_num)02d +numprocs=5 +autostart=true +autorestart=true +directory=/var/www/html +user=www-data +redirect_stderr=true \ No newline at end of file diff --git a/php-fpm/orocommerce/context/etc/supervisord.d/oro-web-socket.ini b/php-fpm/orocommerce/context/etc/supervisord.d/oro-web-socket.ini new file mode 100644 index 0000000..a3c450a --- /dev/null +++ b/php-fpm/orocommerce/context/etc/supervisord.d/oro-web-socket.ini @@ -0,0 +1,8 @@ +[program:oro_web_socket] +command=php ./bin/console gos:websocket:server --env=prod +numprocs=1 +autostart=true +autorestart=true +directory=/var/www/html +user=www-data +redirect_stderr=true \ No newline at end of file diff --git a/php-fpm/orocommerce/context/oro-init b/php-fpm/orocommerce/context/oro-init new file mode 100755 index 0000000..e3696d8 --- /dev/null +++ b/php-fpm/orocommerce/context/oro-init @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +# Start supervisord +if [[ ${SUPERVISORD_START:-1} -eq 1 && -e /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Client/ConsumeMessagesCommand.php ]]; then + sudo /usr/bin/supervisord -c /etc/supervisord.conf & +fi diff --git a/php-fpm/orocommerce/debug/Dockerfile b/php-fpm/orocommerce/debug/Dockerfile new file mode 100644 index 0000000..733fec1 --- /dev/null +++ b/php-fpm/orocommerce/debug/Dockerfile @@ -0,0 +1,8 @@ +ARG ENV_SOURCE_IMAGE +ARG PHP_VERSION +FROM ${ENV_SOURCE_IMAGE}:${PHP_VERSION}-orocommerce +USER root + +COPY *.ini /etc/php.d/ + +USER www-data \ No newline at end of file diff --git a/php-fpm/orocommerce/debug/context/50-xdebug.ini b/php-fpm/orocommerce/debug/context/50-xdebug.ini new file mode 100644 index 0000000..b2574e0 --- /dev/null +++ b/php-fpm/orocommerce/debug/context/50-xdebug.ini @@ -0,0 +1,4 @@ +[xdebug] +xdebug.scream=0 +xdebug.show_exception_trace=0 +xdebug.max_nesting_level=256 \ No newline at end of file diff --git a/php-fpm/orocommerce/xdebug3/Dockerfile b/php-fpm/orocommerce/xdebug3/Dockerfile new file mode 100644 index 0000000..733fec1 --- /dev/null +++ b/php-fpm/orocommerce/xdebug3/Dockerfile @@ -0,0 +1,8 @@ +ARG ENV_SOURCE_IMAGE +ARG PHP_VERSION +FROM ${ENV_SOURCE_IMAGE}:${PHP_VERSION}-orocommerce +USER root + +COPY *.ini /etc/php.d/ + +USER www-data \ No newline at end of file diff --git a/php-fpm/orocommerce/xdebug3/context/50-xdebug.ini b/php-fpm/orocommerce/xdebug3/context/50-xdebug.ini new file mode 100644 index 0000000..b2574e0 --- /dev/null +++ b/php-fpm/orocommerce/xdebug3/context/50-xdebug.ini @@ -0,0 +1,4 @@ +[xdebug] +xdebug.scream=0 +xdebug.show_exception_trace=0 +xdebug.max_nesting_level=256 \ No newline at end of file diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 3820720..13581f3 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -1,5 +1,4 @@ ARG POSTGRES_VERSION FROM postgres:${POSTGRES_VERSION} -COPY docker-entrypoint-initdb.d/uuid-ossp-extension.sql /docker-entrypoint-init.d/uuid-ossp-extension.sql - +COPY docker-entrypoint-initdb.d/uuid-ossp-extension.sql /docker-entrypoint-initdb.d/uuid-ossp-extension.sql diff --git a/postgres/docker-entrypoint-initdb.d/add-uuid-ossp-extension.sql b/postgres/docker-entrypoint-initdb.d/add-uuid-ossp-extension.sql new file mode 100644 index 0000000..c941cb3 --- /dev/null +++ b/postgres/docker-entrypoint-initdb.d/add-uuid-ossp-extension.sql @@ -0,0 +1 @@ +CREATE EXTENSION "uuid-ossp"; diff --git a/scripts/build.sh b/scripts/build.sh index dae0be6..48265ba 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -79,8 +79,8 @@ for file in $(find ${SEARCH_PATH} -type f -name Dockerfile | sort -V); do IMAGE_SUFFIX="$(echo "${BUILD_DIR}" | cut -d/ -f2- -s | tr / - | sed 's/^-//')" echo $IMAGE_SUFFIX - ## due to build matrix requirements, magento1 and magento2 specific varients are built in separate invocation - if [[ ${SEARCH_PATH} == "php-fpm" ]] && [[ ${file} =~ php-fpm/magento[1-2] ]]; then + ## due to build matrix requirements, magento and orocommerce specific varients are built in separate invocation + if [[ ${SEARCH_PATH} == "php-fpm" ]] && [[ ${file} =~ php-fpm/magento[1-2] || ${file} == "orocommerce" ]]; then continue; fi @@ -124,8 +124,13 @@ for file in $(find ${SEARCH_PATH} -type f -name Dockerfile | sort -V); do continue fi - if [[ -d "$(echo ${BUILD_DIR} | cut -d/ -f1)/context" ]]; then + # Allow child builds to have their own context directory (e.g. php-fpm/magento2/context) + if [[ -d "${BUILD_DIR}/context" ]]; then + BUILD_CONTEXT="${BUILD_DIR}/context" + # Check if parent directory has a specific context directory + elif [[ -d "$(echo ${BUILD_DIR} | cut -d/ -f1)/context" ]]; then BUILD_CONTEXT="$(echo ${BUILD_DIR} | cut -d/ -f1)/context" + # Use the entire build directory as the context else BUILD_CONTEXT="${BUILD_DIR}" fi