Skip to content

Commit 80403eb

Browse files
Update dev docker files and added sample products for testing
1 parent 5235907 commit 80403eb

15 files changed

Lines changed: 400 additions & 54 deletions

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Exclude development files from Composer exports (composer install / git archive)
2+
/dev export-ignore
3+
/.github export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/CONTRIBUTING.md export-ignore
7+
8+
# Force LF line endings for shell scripts (prevents CRLF issues in Docker)
9+
*.sh text eol=lf

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ composer.phar
1313
\#*
1414
/nbproject/
1515

16+
# Environment
1617
.env
18+
dev/.env

Dockerfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

dev/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PAYSTACK_TEST_PK=pk_test_your_public_key_here
2+
PAYSTACK_TEST_SK=sk_test_your_secret_key_here

dev/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM php:8.3-apache
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
git unzip curl \
6+
libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
7+
libicu-dev libxml2-dev libxslt-dev libzip-dev libonig-dev \
8+
libsodium-dev default-mysql-client \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# Install PHP extensions required by Magento 2
12+
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
13+
&& docker-php-ext-install -j$(nproc) \
14+
bcmath ftp gd intl mbstring pdo_mysql soap xsl zip sockets sodium opcache
15+
16+
# Enable Apache modules
17+
RUN a2enmod rewrite headers
18+
19+
# Install Composer
20+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
21+
22+
# Configure PHP for Magento
23+
RUN echo "memory_limit = 2G" > /usr/local/etc/php/conf.d/magento.ini \
24+
&& echo "max_execution_time = 1800" >> /usr/local/etc/php/conf.d/magento.ini \
25+
&& echo "realpath_cache_size = 10M" >> /usr/local/etc/php/conf.d/magento.ini \
26+
&& echo "realpath_cache_ttl = 7200" >> /usr/local/etc/php/conf.d/magento.ini
27+
28+
WORKDIR /var/www/html
29+
30+
# Download Magento via Mage-OS public mirror (no Adobe marketplace auth needed)
31+
RUN composer config --global audit.block-insecure false \
32+
&& composer create-project \
33+
--repository-url=https://mirror.mage-os.org/ \
34+
magento/project-community-edition=2.4.8-p3 . \
35+
--no-dev --no-interaction
36+
37+
# Point Apache to Magento's pub/ directory
38+
RUN sed -i 's|/var/www/html|/var/www/html/pub|g' /etc/apache2/sites-available/000-default.conf
39+
RUN printf '<Directory /var/www/html/pub>\n AllowOverride All\n</Directory>\n' >> /etc/apache2/apache2.conf
40+
41+
# Disable CSP enforcement for local development
42+
# (Magento 2.4.8 CSP blocks its own inline scripts without this)
43+
RUN echo 'Header unset Content-Security-Policy' >> /etc/apache2/apache2.conf
44+
45+
# Fix permissions
46+
RUN chown -R www-data:www-data /var/www/html
47+
48+
COPY entrypoint.sh /usr/local/bin/
49+
RUN chmod +x /usr/local/bin/entrypoint.sh
50+
51+
EXPOSE 80
52+
53+
ENTRYPOINT ["entrypoint.sh"]
54+
CMD ["apache2-foreground"]

dev/docker-compose.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: paystack-magento
2+
3+
services:
4+
db:
5+
container_name: paystack-db
6+
image: mariadb:10.6
7+
environment:
8+
MARIADB_ROOT_PASSWORD: magento
9+
MARIADB_DATABASE: magento
10+
MARIADB_USER: magento
11+
MARIADB_PASSWORD: magento
12+
volumes:
13+
- db_data:/var/lib/mysql
14+
15+
search:
16+
container_name: paystack-search
17+
image: opensearchproject/opensearch:2.19.1
18+
environment:
19+
- discovery.type=single-node
20+
- "OPENSEARCH_JAVA_OPTS=-Xms256m -Xmx256m"
21+
- DISABLE_SECURITY_PLUGIN=true
22+
volumes:
23+
- search_data:/usr/share/opensearch/data
24+
25+
magento:
26+
container_name: paystack-magento
27+
build: .
28+
ports:
29+
- "8080:80"
30+
environment:
31+
- PAYSTACK_TEST_PK=${PAYSTACK_TEST_PK}
32+
- PAYSTACK_TEST_SK=${PAYSTACK_TEST_SK}
33+
volumes:
34+
- ..:/var/www/html/app/code/Pstk/Paystack
35+
depends_on:
36+
- db
37+
- search
38+
39+
volumes:
40+
db_data:
41+
search_data:

dev/entrypoint.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Only run Magento setup on first boot
5+
if [ ! -f /var/www/html/app/etc/env.php ]; then
6+
echo "==> Waiting for database to be ready..."
7+
until php -r "new PDO('mysql:host=paystack-db;dbname=magento', 'magento', 'magento');" 2>/dev/null; do
8+
sleep 2
9+
done
10+
11+
echo "==> Installing Magento..."
12+
php bin/magento setup:install \
13+
--base-url=http://localhost:8080 \
14+
--db-host=paystack-db \
15+
--db-name=magento \
16+
--db-user=magento \
17+
--db-password=magento \
18+
--search-engine=opensearch \
19+
--opensearch-host=paystack-search \
20+
--opensearch-port=9200 \
21+
--admin-firstname=Admin \
22+
--admin-lastname=MyStore \
23+
--admin-email=admin@example.com \
24+
--admin-user=admin \
25+
--admin-password='Admin12345!' \
26+
--backend-frontname=admin \
27+
--language=en_US \
28+
--currency=NGN \
29+
--timezone=Africa/Lagos \
30+
--use-rewrites=1 \
31+
--cleanup-database
32+
33+
chown -R www-data:www-data /var/www/html
34+
echo "==> Magento installation complete."
35+
fi
36+
37+
exec "$@"

dev/img/products/paystack-cap.png

1.95 MB
Loading
2.39 MB
Loading
1.06 MB
Loading

0 commit comments

Comments
 (0)