From 7372eb4a4ecb2b8a3928577a7bc163df49d27513 Mon Sep 17 00:00:00 2001 From: MYDev Date: Thu, 19 Mar 2026 17:31:55 +0200 Subject: [PATCH] first commit --- .env | 6 ++-- Dockerfile | 76 +++++++++++++++++++++++++++++++++++----------- docker-compose.yml | 2 +- 3 files changed, 62 insertions(+), 22 deletions(-) diff --git a/.env b/.env index dc3e5d0..71fac06 100644 --- a/.env +++ b/.env @@ -3,15 +3,15 @@ #=======================# # options: [8.0,8.1,8.2,8.3,8.4,8.5] -PHP_VERSION=8.2 -# options: [opencart,laravel,symfony] +PHP_VERSION=8.4 +# options: [laravel,symfony,magento2,wordpress,opencart] FRAMEWORK=opencart # options: [local,prod,proxy] MODE=proxy PORT=80 # in case MODE is production set below server name {example.com} # SERVER_NAME= - +PROJECT_NAME='opencart' #=========================# # Database Configurations # #=========================# diff --git a/Dockerfile b/Dockerfile index db0779e..6928231 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,40 +1,80 @@ ARG PHP_VERSION -FROM dunglas/frankenphp:php${PHP_VERSION}-alpine +FROM dunglas/frankenphp:php${PHP_VERSION}-alpine AS base # add additional extensions here: RUN install-php-extensions \ pdo_mysql \ - mysqli \ - gd \ - imagick \ - intl \ - zip \ - bcmath \ - soap \ - sqlite3 \ mbstring \ curl \ xml \ dom \ fileinfo \ + intl \ + zip \ opcache \ ctype \ iconv \ openssl \ tokenizer \ - simplexml \ - xsl \ + simplexml + +# ------------------------- +# Node.js layer +# ------------------------- +FROM base AS node +RUN apt-get update \ + && apt-get install -y curl gnupg \ + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs \ + && node -v \ + && npm -v \ + && rm -rf /var/lib/apt/lists/* + +# ------------------------- +# Symfony profile +# ------------------------- +FROM node AS symfony +RUN install-php-extensions \ + apcu \ + sodium + +# ------------------------- +# Laravel profile +# ------------------------- +FROM node AS laravel +RUN install-php-extensions \ + redis + +# ------------------------- +# WordPress profile +# ------------------------- +FROM base AS wordpress +RUN install-php-extensions \ + mysqli \ exif \ - sodium \ - redis \ - apcu + imagick + +# ------------------------- +# Magento 2 profile +# ------------------------- +FROM base AS magento2 +RUN install-php-extensions \ + mysqli \ + xsl \ + soap \ + bcmath \ + sodium + +# ------------------------- +# OpenCart profile +# ------------------------- +FROM base AS opencart +RUN install-php-extensions \ + mysqli + # Install Composer COPY --from=composer:2 /usr/bin/composer /usr/bin/composer - -# Install Node.js -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ - && apt-get install -y nodejs # Fix permissions for storage & cache (FrankenPHP runs as UID 65534 = nobody) RUN if [ -d /app/storage ]; then chown -R 65534:65534 /app/storage /app/bootstrap/cache; fi diff --git a/docker-compose.yml b/docker-compose.yml index 5f5b2b4..ba0ecde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,11 +3,11 @@ services: build: context: . dockerfile: Dockerfile + target: ${FRAMEWORK} args: # args from .env file PHP_VERSION: ${PHP_VERSION} MODE: ${MODE} - container_name: ${FRAMEWORK}${PHP_VERSION} restart: unless-stopped networks: - app-network