Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OroCommerce Images #19

Merged
merged 12 commits into from
Sep 6, 2024
43 changes: 43 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
20 changes: 16 additions & 4 deletions .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 45 additions & 0 deletions nginx/etc/nginx/available.d/orocommerce.conf
Original file line number Diff line number Diff line change
@@ -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;
}
41 changes: 41 additions & 0 deletions php-fpm/orocommerce/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions php-fpm/orocommerce/blackfire/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions php-fpm/orocommerce/context/etc/php.d/75-oro.ini
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions php-fpm/orocommerce/context/oro-init
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions php-fpm/orocommerce/debug/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions php-fpm/orocommerce/debug/context/50-xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[xdebug]
xdebug.scream=0
xdebug.show_exception_trace=0
xdebug.max_nesting_level=256
8 changes: 8 additions & 0 deletions php-fpm/orocommerce/xdebug3/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions php-fpm/orocommerce/xdebug3/context/50-xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[xdebug]
xdebug.scream=0
xdebug.show_exception_trace=0
xdebug.max_nesting_level=256
3 changes: 1 addition & 2 deletions postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE EXTENSION "uuid-ossp";
11 changes: 8 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down