Skip to content

Commit

Permalink
Magento 2.4.7 base image
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-bouvy committed May 30, 2024
1 parent dd182f6 commit b8f8a18
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/2.4.7-bookworm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 2.4.7 Bookworm - Build and Push Docker Image to Docker Hub

on:
push:
branches:
- main
paths:
- 2.4.7/bookworm/**
- config/**

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./2.4.7/bookworm/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: clickandmortar/magento:2.4.7-bookworm
19 changes: 19 additions & 0 deletions 2.4.7/bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM php:8.3.7-fpm-bookworm AS php

ENV MAGE_MODE=production

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libfreetype6-dev libicu-dev libjpeg62-turbo-dev libpng-dev libxslt1-dev libzip-dev libwebp-dev \
&& rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install -j$(nproc) bcmath gd intl pdo_mysql soap sockets xsl zip

RUN curl -sSL https://getcomposer.org/download/latest-2.x/composer.phar -o /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer

WORKDIR /app

COPY config/php/custom.ini /usr/local/etc/php/conf.d/90-magento.ini
COPY config/php/www.conf /usr/local/etc/php-fpm.d/www.conf
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
# magento-docker
Magento / Adobe Commerce base Docker images
# Magento Docker

Magento / Adobe Commerce base Docker images for production usage.

## Available images

| Name | Version | PHP version | Dockerfile | Architectures | Tags |
|--------------------------|---------|-------------|-----------------------------------------|------------------|------------------|
| `clickandmortar/magento` | 2.4.7 | 8.3 | [Dockerfile](2.4.7/bookworm/Dockerfile) | `amd64`, `arm64` | `2.4.7-bookworm` |

## Usage

### Configuration

The `MAGE_MODE` environment variable can be set to `developer`, `production` or `default` (default is `production`).

If you need to override PHP or FPM configuration, you can mount custom configuration files:

* `custom.ini` should be mounted at `/usr/local/etc/php/conf.d/99-custom.ini`
* `www.conf` should be mounted over `/usr/local/etc/php-fpm.d/www.conf`

### Docker Compose

```yaml
version: '3.7'
services:
magento:
image: clickandmortar/magento:2.4.7-bookworm
volumes:
- ./:/app/
```
18 changes: 18 additions & 0 deletions config/php/custom.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
date.timezone = Etc/UTC
; Recommended value by Magento / Adobe Commerce
memory_limit = 756M
log_errors = On
display_errors = Off
display_startup_errors = Off
expose_php = Off

opcache.enable = 1
opcache.enable_cli = 1
opcache.save_comments = 1
opcache.memory_consumption = 1024
opcache.interned_strings_buffer = 32
opcache.max_accelerated_files = 130987
opcache.enable_file_override = 1

realpath_cache_size = 10M
realpath_cache_ttl = 7200
12 changes: 12 additions & 0 deletions config/php/www.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[www]
user = www-data
group = www-data

listen = 127.0.0.1:9000

pm = static
; Or use an environment variable, such as ${PHP_FPM_MAX_CHILDREN}
pm.max_children = 10
pm.status_path = /status
; Useful to avoid memory leaks ; processes will be restarted after handling 10 requests
pm.max_requests = 10

0 comments on commit b8f8a18

Please sign in to comment.