Skip to content

Commit 8b4f0d9

Browse files
WIP
1 parent 3821337 commit 8b4f0d9

File tree

5 files changed

+221
-0
lines changed

5 files changed

+221
-0
lines changed

.github/workflows/mage-os.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Magento 2.4 Community Edition Docker container build
2+
on:
3+
push:
4+
pull_request:
5+
schedule:
6+
- cron: '0 0 * * 1'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
cfg:
15+
- { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.3.1, SAMPLE_DATA: true }
16+
- { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.3.1, SAMPLE_DATA: false }
17+
- { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.3.0, SAMPLE_DATA: true }
18+
- { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.3.0, SAMPLE_DATA: false }
19+
20+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.2.0, SAMPLE_DATA: false }
21+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.1.1, SAMPLE_DATA: false }
22+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.1.0, SAMPLE_DATA: false }
23+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.6, SAMPLE_DATA: false }
24+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.5, SAMPLE_DATA: false }
25+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.4, SAMPLE_DATA: false }
26+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.3, SAMPLE_DATA: false }
27+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.2, SAMPLE_DATA: false }
28+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.1, SAMPLE_DATA: false }
29+
# - { PHP_VERSION: php83-fpm, MAGEOS_VERSION: 1.0.0, SAMPLE_DATA: false }
30+
steps:
31+
- uses: actions/checkout@v5
32+
33+
# Step 1: Build the docker image
34+
- name: Build the Docker image (without sample data)
35+
if: matrix.cfg.SAMPLE_DATA == false
36+
run:
37+
docker build mage-os -f mage-os/Dockerfile
38+
-t michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}
39+
--build-arg MAGEOS_VERSION=${{ matrix.cfg.MAGEOS_VERSION }}
40+
--build-arg PHP_VERSION=${{ matrix.cfg.PHP_VERSION }}
41+
42+
- name: Build the Docker image (with sample data)
43+
if: matrix.cfg.SAMPLE_DATA == true
44+
run:
45+
docker build mage-os -f mage-os/Dockerfile
46+
-t michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}-sample-data
47+
--build-arg MAGEOS_VERSION=${{ matrix.cfg.MAGEOS_VERSION }}
48+
--build-arg PHP_VERSION=${{ matrix.cfg.PHP_VERSION }}
49+
--build-arg SAMPLE_DATA=true
50+
51+
# Step 2: Test the docker image
52+
- name: Start the docker image (without sample date)
53+
if: matrix.cfg.SAMPLE_DATA == false
54+
run:
55+
docker run --memory=4G --detach --name mage-os-community-edition
56+
michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}
57+
58+
- name: Start the docker image (with sample date)
59+
if: matrix.cfg.SAMPLE_DATA == true
60+
run:
61+
docker run --detach --name mage-os-community-edition
62+
michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}-sample-data
63+
64+
- name: Copy the example test module
65+
run: |
66+
docker exec mage-os-community-edition mkdir -vp /data/extensions/MichielGerritsen-ExampleTest/Test/Integration/
67+
docker exec mage-os-community-edition mkdir -vp /data/extensions/MichielGerritsen-ExampleTest/Test/Unit/
68+
echo "Copying Test/composer.json"
69+
docker cp Test/composer.json mage-os-community-edition:/data/extensions/MichielGerritsen-ExampleTest/
70+
echo "Copying Test/ExampleIntegrationTest.php"
71+
docker cp Test/ExampleIntegrationTest.php mage-os-community-edition:/data/extensions/MichielGerritsen-ExampleTest/Test/Integration/
72+
echo "Copying Test/ExampleUnitTest.php"
73+
docker cp Test/ExampleUnitTest.php mage-os-community-edition:/data/extensions/MichielGerritsen-ExampleTest/Test/Unit/
74+
75+
- name: Install the example test module
76+
run: docker exec mage-os-community-edition composer require michielgerritsen/exampletest:@dev
77+
78+
- name: Enable developer mode
79+
run: docker exec mage-os-community-edition ./retry "bin/magento deploy:mode:set developer"
80+
81+
- name: Run setup:di:compile
82+
run: docker exec mage-os-community-edition ./retry "php bin/magento setup:di:compile"
83+
84+
- name: Run the example integration test
85+
run: docker exec mage-os-community-edition bash -c "cd /data/dev/tests/integration/ && ../../../vendor/bin/phpunit /data/vendor/michielgerritsen/exampletest/Test/Integration/ExampleIntegrationTest.php"
86+
87+
- name: Run the example unit test
88+
run: docker exec mage-os-community-edition bash -c "cd /data/dev/tests/unit/ && ../../../vendor/bin/phpunit /data/vendor/michielgerritsen/exampletest/Test/Unit/ExampleUnitTest.php"
89+
90+
# Step 3: Upload the images to Docker Hub.
91+
- name: Docker hub login
92+
if: github.ref == 'refs/heads/master'
93+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
94+
95+
- name: Push the image to Docker hub (without sample data)
96+
if: github.ref == 'refs/heads/master' && matrix.cfg.SAMPLE_DATA == false
97+
run: docker push michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}
98+
99+
- name: Push the image to Docker hub (with sample data)
100+
if: github.ref == 'refs/heads/master' && matrix.cfg.SAMPLE_DATA == true
101+
run: docker push michielgerritsen/mage-os-community-edition:${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}-sample-data
102+
103+
- name: Dump Docker logs files (on failure)
104+
if: failure()
105+
run: |
106+
mkdir failure-logs
107+
docker logs mage-os-community-edition > failure-logs/docker.log
108+
docker cp mage-os-community-edition:/data/var/log failure-logs/var/log
109+
110+
- name: Upload failure artifacts
111+
if: failure()
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: failure-artifacts-${{ matrix.cfg.PHP_VERSION }}-mage-os{{ matrix.cfg.MAGEOS_VERSION }}
115+
path: |
116+
failure-logs

.github/workflows/magento-2.3.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Magento 2.3 Community Edition Docker container build
22
on:
33
push:
4+
branches:
5+
- '!mage-os'
46
pull_request:
57
schedule:
68
- cron: '0 0 * * 1'

.github/workflows/magento-2.4.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Magento 2.4 Community Edition Docker container build
22
on:
33
push:
4+
branches:
5+
- '!mage-os'
46
pull_request:
57
schedule:
68
- cron: '0 0 * * 1'

.github/workflows/magento-with-replacements.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Magento 2.4 with Composer replacements
22
on:
33
push:
4+
branches:
5+
- '!mage-os'
46
pull_request:
57
schedule:
68
- cron: '0 0 * * 1'

mage-os/Dockerfile

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
ARG PHP_VERSION=php74-fpm
2+
FROM michielgerritsen/magento2-base-image:${PHP_VERSION}
3+
4+
ARG MAGEOS_VERSION=2.4.4
5+
ARG MAGEOS_TYPE=project-community-edition
6+
ARG SAMPLE_DATA=false
7+
ARG DISABLE_2FA=true
8+
ARG COMPOSER_AUTH={}
9+
10+
ENV CI=true
11+
ENV URL=http://localhost/
12+
ENV FLAT_TABLES=false
13+
ENV COMPOSER_ALLOW_SUPERUSER=1
14+
15+
COPY scripts/retry retry
16+
COPY patches/ patches/
17+
COPY scripts/apply-2.4-patches.php scripts/apply-2.4-patches.php
18+
COPY scripts/downgrade-monolog.php scripts/downgrade-monolog.php
19+
COPY scripts/upgrade-to-composer-2.php scripts/upgrade-to-composer-2.php
20+
COPY scripts/allow-composer-plugins.php scripts/allow-composer-plugins.php
21+
COPY scripts/remove-paypal-braintree.php scripts/remove-paypal-braintree.php
22+
COPY scripts/patch-AC2855.php scripts/patch-AC2855.php
23+
COPY templates/memory-limit-php.ini /usr/local/etc/php/conf.d/memory-limit-php.ini
24+
25+
RUN set -e; \
26+
./start-services && \
27+
composer self-update --2 && \
28+
echo "[cad] Composer version:" && \
29+
composer --version && \
30+
echo "[cad] Downloading & unzipping Magento" && \
31+
curl -o mage-os.zip https://repo.mage-os.org/dist/magento/$MAGEOS_TYPE/magento-$MAGEOS_TYPE-$MAGEOS_VERSION.zip && \
32+
unzip -q mage-os.zip -d . && \
33+
rm mage-os.zip; \
34+
echo "[cad] Allowing composer plugins" && \
35+
php scripts/allow-composer-plugins.php && \
36+
rm scripts/allow-composer-plugins.php && \
37+
echo "[cad] Upgrading to composer 2" && \
38+
php scripts/upgrade-to-composer-2.php && \
39+
rm scripts/upgrade-to-composer-2.php && \
40+
if [ "$MAGEOS_VERSION" != "2.4.9-alpha2" ]; then \
41+
composer config --unset repositories.0 && \
42+
composer config repositories.fooman composer https://repo-magento-mirror.fooman.co.nz/; \
43+
fi && \
44+
if [ "$MAGEOS_VERSION" = "2.4.4" ]; then composer require "magento/security-package:1.1.3-p1 as 1.1.3" --no-update; fi && \
45+
if [ "$MAGEOS_VERSION" = "2.4.4" ]; then composer require "magento/inventory-metapackage:1.2.4-p1 as 1.2.4" --no-update; fi && \
46+
echo "[cad] Running Composer install" && \
47+
./retry "composer install" && \
48+
php scripts/patch-AC2855.php && \
49+
php scripts/downgrade-monolog.php && \
50+
php scripts/remove-paypal-braintree.php && \
51+
echo "[cad] Updating XML" && \
52+
if [ -f "/data/vendor/magento/module-inventory-catalog/etc/communication.xml" ]; then sed -i 's/is_synchronous="false"//g' /data/vendor/magento/module-inventory-catalog/etc/communication.xml; fi && \
53+
if [ -f "/data/vendor/magento/module-inventory-sales/etc/communication.xml" ]; then sed -i 's/is_synchronous="false"//g' /data/vendor/magento/module-inventory-sales/etc/communication.xml; fi && \
54+
if [ -f "/data/vendor/magento/module-inventory-indexer/etc/communication.xml" ]; then sed -i 's/is_synchronous="false"//g' /data/vendor/magento/module-inventory-indexer/etc/communication.xml; fi && \
55+
composer dump-autoload && \
56+
echo "[cad] Running Magento setup:install" && \
57+
php bin/magento setup:install --backend-frontname=admin --session-save=db --db-host=127.0.0.1 --db-name=magento --db-user=magento --db-password=password --base-url=http://localhost --timezone=Europe/Amsterdam --currency=EUR --admin-user=exampleuser --admin-password=examplepassword123 --admin-email=user@example.com --admin-firstname=Example --admin-lastname=Example --use-rewrites=1 --use-sample-data && \
58+
echo "[cad] Setting developer mode" && \
59+
php bin/magento deploy:mode:set developer && \
60+
if [ "${SAMPLE_DATA}" = "true" ] && [ "$MAGEOS_VERSION" != "2.4.9-alpha2" ]; then echo "[cad] Running php bin/magento sampledata:deploy"; php bin/magento sampledata:deploy; fi && \
61+
if [ "${SAMPLE_DATA}" = "true" ] && [ "$MAGEOS_VERSION" = "2.4.9-alpha2" ]; then echo "[cad] Installing sampledata"; composer require mage-os/module-bundle-sample-data mage-os/module-catalog-sample-data mage-os/module-sales-sample-data mage-os/module-customer-sample-data mage-os/module-cms-sample-data mage-os/module-widget-sample-data mage-os/module-theme-sample-data mage-os/module-downloadable-sample-data mage-os/module-wishlist-sample-data mage-os/module-review-sample-data mage-os/module-tax-sample-data mage-os/module-catalog-rule-sample-data mage-os/module-configurable-sample-data mage-os/module-product-links-sample-data mage-os/module-sales-rule-sample-data mage-os/module-msrp-sample-data mage-os/module-grouped-product-sample-data mage-os/module-swatches-sample-data mage-os/module-offline-shipping-sample-data magento/sample-data-media --ignore-platform-reqs; fi && \
62+
if [ "${SAMPLE_DATA}" = "true" ]; then echo "[cad] Running setup:upgrade" && ./retry "php bin/magento setup:upgrade"; fi && \
63+
php bin/magento setup:static-content:deploy en_US -f -j 12 && \
64+
php bin/magento setup:di:compile && \
65+
php bin/magento indexer:reindex && \
66+
mkdir -p extensions && \
67+
composer config repositories.dev-extensions path extensions/* && \
68+
composer require --dev phpstan/phpstan bitexpert/phpstan-magento phpstan/extension-installer && \
69+
php scripts/apply-2.4-patches.php && \
70+
rm scripts/apply-2.4-patches.php && \
71+
rm scripts/downgrade-monolog.php && \
72+
./stop-services
73+
74+
COPY templates/supervisord-webserver.conf /etc/supervisor/conf.d/webserver.conf
75+
COPY templates/install-config-mysql.php dev/tests/integration/etc/
76+
COPY templates/post-install-setup-command-config.php dev/tests/integration/etc/
77+
COPY entrypoint.sh entrypoint.sh
78+
79+
COPY scripts/enable-flat-catalog enable-flat-catalog
80+
COPY scripts/change-base-url change-base-url
81+
COPY scripts/install-composer-package install-composer-package
82+
COPY scripts/disable-2fa disable-2fa
83+
84+
COPY templates/phpunit-integration.xml dev/tests/integration/phpunit.xml
85+
COPY templates/phpunit-integration-248.xml dev/tests/integration/phpunit-248.xml
86+
COPY templates/phpunit-unit.xml dev/tests/unit/phpunit.xml
87+
COPY templates/phpunit-unit-248.xml dev/tests/unit/phpunit-248.xml
88+
COPY scripts/fix-phpunit.xml.php fix-phpunit.xml.php
89+
90+
RUN chmod +x enable-flat-catalog && \
91+
chmod +x change-base-url && \
92+
php fix-phpunit.xml.php && \
93+
rm fix-phpunit.xml.php && \
94+
rm dev/tests/integration/phpunit-248.xml && \
95+
rm dev/tests/unit/phpunit-248.xml
96+
97+
ENTRYPOINT ["/bin/bash", "entrypoint.sh"]
98+
99+
EXPOSE 80 3306

0 commit comments

Comments
 (0)