Skip to content

Commit

Permalink
Merge pull request #107 from akunzai/docker-compose
Browse files Browse the repository at this point in the history
Polish Dockerfile setup
  • Loading branch information
akunzai authored Nov 6, 2024
2 parents b9ba80d + 3a812c5 commit eaf64c2
Show file tree
Hide file tree
Showing 38 changed files with 104 additions and 115 deletions.
28 changes: 15 additions & 13 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ services:
context: ./joomla
image: joomla:3.10-magebridge
volumes:
- joomla-data:/var/www/html
- joomla_data:/var/www/html
- joomla_log:/var/www/html/administrator/logs
- ..:/workspace:cached
- ./php.ini:/usr/local/etc/php/php.ini:ro
- ./joomla/log:/var/www/html/administrator/logs
environment:
JOOMLA_DB_HOST: ${JOOMLA_DB_HOST:-mysql}
JOOMLA_DB_PASSWORD: ${JOOMLA_DB_PASSWORD:-${MYSQL_ROOT_PASSWORD:-secret}}
# https://xdebug.org/docs/all_settings
XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
XDEBUG_MODE: debug
# XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
# XDEBUG_MODE: debug
external_links:
- traefik:store.dev.local
labels:
Expand All @@ -30,16 +30,16 @@ services:
context: ./openmage
image: openmage:1.9-magebridge
volumes:
- openmage-data:/var/www/html
- openmage_data:/var/www/html
- openmage_log:/var/www/html/var/log
- ..:/var/www/html/.modman/MageBridge:cached
- ./php.ini:/usr/local/etc/php/php.ini:ro
- ./openmage/log:/var/www/html/var/log
environment:
# environment:
# https://github.com/OpenMage/magento-lts/blob/32773dd4f82bb44bac89e8eca97379dad2a10af5/app/Mage.php#L22
# MAGE_IS_DEVELOPER_MODE: '1'
# https://xdebug.org/docs/all_settings
XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
XDEBUG_MODE: debug
# XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
# XDEBUG_MODE: debug
external_links:
- traefik:www.dev.local
labels:
Expand All @@ -54,7 +54,7 @@ services:
# https://hub.docker.com/_/mysql
image: mysql
volumes:
- mysql-data:/var/lib/mysql
- mysql_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-secret}
MYSQL_DATABASE: ${MYSQL_DATABASE:-openmage}
Expand Down Expand Up @@ -93,6 +93,8 @@ secrets:
file: .secrets/key.pem

volumes:
joomla-data: null
mysql-data: null
openmage-data: null
joomla_data: null
joomla_log: null
mysql_data: null
openmage_data: null
openmage_log: null
49 changes: 24 additions & 25 deletions .devcontainer/joomla/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# https://mcr.microsoft.com/v2/vscode/devcontainers/php/tags/list
ARG PHP_VERSION=7.4
ARG PHP_EXTRA_BUILD_DEPS=""
# https://hub.docker.com/_/joomla
ARG JOOMLA_VERSION=3.10.12

Expand All @@ -9,32 +10,28 @@ FROM joomla:${JOOMLA_VERSION}-apache AS joomla
FROM php:${PHP_VERSION}-apache

ENV LANG=en_US.UTF-8

# install MySQL client
RUN apt-get update \
&& apt-get install -y --no-install-recommends default-mysql-client \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# install pickle
# https://github.com/FriendsOfPHP/pickle
RUN set -eux; \
curl -Lo /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
chmod +x /usr/local/bin/pickle;

# install the PHP extensions we need
RUN set -eux; \
savedAptMark="$(apt-mark showmanual)"; \
RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
set -eux; \
apt-get update; \
# install the system tools we need
apt-get install -y --no-install-recommends mariadb-client; \
# install the PHP extensions we need
savedAptMark="$(apt-mark showmanual)"; \
apt-get install -y --no-install-recommends \
libfreetype6-dev libicu-dev libjpeg62-turbo-dev \
libpng-dev libxml2-dev libxslt1-dev libzip-dev libwebp-dev \
libfreetype6-dev libicu-dev \
libjpeg62-turbo-dev libpng-dev \
libxml2-dev libxslt1-dev \
libzip-dev libwebp-dev \
${PHP_EXTRA_BUILD_DEPS:-}; \
# https://www.php.net/manual/en/image.installation.php
docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j$(nproc) opcache \
intl gd mysqli pcntl pdo_mysql soap xsl zip; \
pickle install --no-interaction apcu; \
pickle install --no-interaction redis; \
curl -Lo /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
chmod +x /usr/local/bin/pickle; \
pickle install --no-interaction apcu-stable; \
pickle install --no-interaction redis-stable; \
pickle install --no-interaction xdebug-3.1.6; \
docker-php-ext-enable apcu opcache redis xdebug; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
Expand All @@ -48,17 +45,19 @@ RUN set -eux; \
| sort -u \
| xargs -r apt-mark manual; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*;
rm -rf /tmp/*;

# set up Apache2
RUN set -eux; \
# enable Apache2 modules
a2enmod rewrite expires include deflate remoteip headers; \
# disable Apache2 server signature
echo 'ServerSignature Off' >> /etc/apache2/apache2.conf; \
echo 'ServerTokens Prod' >> /etc/apache2/apache2.conf; \
# enable support for TLS termination
echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on' >> /etc/apache2/apache2.conf;
{ \
# disable Apache2 server signature
echo 'ServerSignature Off'; \
echo 'ServerTokens Prod'; \
# enable support for TLS termination
echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on'; \
} >> /etc/apache2/apache2.conf;

# install composer
# https://hub.docker.com/_/composer
Expand Down
72 changes: 30 additions & 42 deletions .devcontainer/openmage/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# https://github.com/colinmollenhour/docker-openmage/blob/main/8.2/apache/Dockerfile
# https://github.com/OpenMage/magento-lts/tree/main/dev/openmage
ARG PHP_VERSION=7.4
ARG PHP_EXTRA_BUILD_DEPS=""
ARG OPENMAGE_VERSION=19.5.3

FROM alpine as unzipper
FROM composer AS builder
ARG OPENMAGE_VERSION
RUN set -eux; \
apk add curl unzip; \
mkdir -p /usr/src/openmage; \
mkdir -p /usr/src/openmage; \
curl -Lo /tmp/openmage.zip https://github.com/OpenMage/magento-lts/releases/download/v${OPENMAGE_VERSION}/openmage-v${OPENMAGE_VERSION}.zip; \
unzip /tmp/openmage.zip -d /usr/src/openmage; \
rm /tmp/openmage.zip;
Expand All @@ -16,39 +16,29 @@ RUN set -eux; \
FROM php:${PHP_VERSION}-apache

ENV LANG=en_US.UTF-8

# install MySQL client
RUN apt-get update && \
apt-get install -y --no-install-recommends default-mysql-client && \
apt-get clean -y && rm -rf /var/lib/apt/lists/*

# install pickle
# https://github.com/FriendsOfPHP/pickle
RUN set -eux; \
curl -Lo /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
chmod +x /usr/local/bin/pickle;

# install the PHP extensions we need
RUN set -eux; \
# https://github.com/colinmollenhour/modman
curl -fSL -o /usr/local/bin/modman https://raw.githubusercontent.com/colinmollenhour/modman/master/modman && \
chmod +x /usr/local/bin/modman; \
# https://github.com/netz98/n98-magerun
curl -fSL -o /usr/local/bin/n98-magerun https://files.magerun.net/n98-magerun.phar && \
chmod +x /usr/local/bin/n98-magerun; \
RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
set -eux; \
apt-get update; \
# install the system tools we need
apt-get install -y --no-install-recommends mariadb-client; \
# install the PHP extensions we need
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends default-mysql-client \
libfreetype6-dev libicu-dev libjpeg62-turbo-dev libonig-dev \
libpng-dev libxml2-dev libxslt1-dev libzip-dev libwebp-dev \
apt-get install -y --no-install-recommends \
libonig-dev \
libfreetype6-dev libicu-dev \
libjpeg62-turbo-dev libpng-dev \
libxml2-dev libxslt1-dev \
libzip-dev libwebp-dev \
${PHP_EXTRA_BUILD_DEPS:-}; \
# https://www.php.net/manual/en/image.installation.php
docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j$(nproc) opcache \
intl gd mysqli pcntl pdo_mysql soap xsl zip; \
pickle install --no-interaction apcu; \
pickle install --no-interaction redis; \
curl -Lo /usr/local/bin/pickle https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
chmod +x /usr/local/bin/pickle; \
pickle install --no-interaction apcu-stable; \
pickle install --no-interaction redis-stable; \
pickle install --no-interaction xdebug-3.1.6; \
docker-php-ext-enable apcu opcache redis xdebug; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
Expand All @@ -62,37 +52,35 @@ RUN set -eux; \
| sort -u \
| xargs -r apt-mark manual; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*;
rm -rf /tmp/*;

# set up Apache2
RUN set -eux; \
# enable Apache2 modules
a2enmod rewrite expires include deflate remoteip headers; \
# disable Apache2 server signature
echo 'ServerSignature Off' >> /etc/apache2/apache2.conf; \
echo 'ServerTokens Prod' >> /etc/apache2/apache2.conf; \
# enable support for TLS termination
echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on' >> /etc/apache2/apache2.conf;
{ \
# disable Apache2 server signature
echo 'ServerSignature Off'; \
echo 'ServerTokens Prod'; \
# enable support for TLS termination
echo 'SetEnvIf X-Forwarded-Proto https HTTPS=on'; \
} >> /etc/apache2/apache2.conf;

# install composer
# https://hub.docker.com/_/composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

# install modman
# https://github.com/colinmollenhour/modman
RUN set -eux; \
curl -fSL -o /usr/local/bin/modman https://raw.githubusercontent.com/colinmollenhour/modman/master/modman && \
chmod +x /usr/local/bin/modman;
ADD --chmod=755 https://raw.githubusercontent.com/colinmollenhour/modman/master/modman /usr/local/bin/modman

# install n98-magerun
# https://github.com/netz98/n98-magerun
RUN set -eux; \
curl -fSL -o /usr/local/bin/n98-magerun https://files.magerun.net/n98-magerun.phar && \
chmod +x /usr/local/bin/n98-magerun;
ADD --chmod=755 https://files.magerun.net/n98-magerun.phar /usr/local/bin/n98-magerun

# set up OpenMage
COPY --chmod=755 ./docker-entrypoint.sh /
COPY --from=unzipper --chown=www-data:www-data /usr/src/openmage /usr/src/openmage
COPY --from=builder --chown=www-data:www-data /usr/src/openmage /usr/src/openmage
RUN set -eux; \
chmod +x /docker-entrypoint.sh; \
chown -R www-data:www-data /usr/src/openmage; \
Expand Down
2 changes: 1 addition & 1 deletion joomla/com_magebridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<creationDate>August 2017</creationDate>
<copyright>Copyright (C) 2017 Yireo.com. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>COM_MAGEBRIDGE_DESC</description>

<!-- installation part -->
Expand Down
2 changes: 1 addition & 1 deletion joomla/libraries/yireo/yireo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<creationDate>September 2017</creationDate>
<copyright>Copyright 2016 Yireo.com. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>

<languages folder="language/en-GB">
<language tag="en-GB">en-GB.lib_yireo.ini</language>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.yireo.com/</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_BLOCK_DESC</description>

<files>
Expand Down
2 changes: 1 addition & 1 deletion joomla/modules/mod_magebridge_cart/mod_magebridge_cart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_CART_DESC</description>

<files>
Expand Down
2 changes: 1 addition & 1 deletion joomla/modules/mod_magebridge_cms/mod_magebridge_cms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.yireo.com/</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_CMS_DESC</description>

<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_LOGIN</description>

<files>
Expand Down
2 changes: 1 addition & 1 deletion joomla/modules/mod_magebridge_menu/mod_magebridge_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_MENU_DESC</description>

<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_NEWSLETTER_DESC</description>

<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_PROGRESS_DESC</description>

<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_SWITCHER_DESC</description>

<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://www.yireo.com/</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>MOD_MAGEBRIDGE_WIDGET_DESC</description>

<files>
Expand Down
2 changes: 1 addition & 1 deletion joomla/pkg_magebridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>MageBridge</name>
<author>Charley Wu</author>
<creationDate>October 2022</creationDate>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<packagename>magebridge</packagename>

<files folder="packages">
Expand Down
2 changes: 1 addition & 1 deletion joomla/plugins/authentication/magebridge/magebridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.yireo.com</authorUrl>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>PLG_AUTHENTICATION_MAGEBRIDGE_DESC</description>

<files>
Expand Down
2 changes: 1 addition & 1 deletion joomla/plugins/community/magebridge/magebridge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<creationDate>August 2017</creationDate>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<copyright>Copyright (C) 2017 Yireo.com. All rights reserved.</copyright>
<version>1.9.6100-beta</version>
<version>1.9.6100</version>
<description>PLG_COMMUNITY_MAGEBRIDGE_DESC</description>
<isapplication>false</isapplication>

Expand Down
Loading

0 comments on commit eaf64c2

Please sign in to comment.