Files
php-container/Dockerfile
T

92 lines
1.9 KiB
Docker

ARG PHP_VERSION
FROM dunglas/frankenphp:php${PHP_VERSION}-trixie AS base
# add additional extensions here:
RUN install-php-extensions \
pdo_mysql \
mbstring \
curl \
xml \
dom \
fileinfo \
intl \
zip \
opcache \
ctype \
iconv \
openssl \
tokenizer \
simplexml
# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN chmod +x /usr/bin/composer
# -------------------------
# 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 \
redis
# -------------------------
# Laravel profile
# -------------------------
FROM node AS laravel
RUN install-php-extensions \
redis
# -------------------------
# WordPress profile
# -------------------------
FROM base AS wordpress
RUN install-php-extensions \
mysqli \
exif \
imagick \
redis
# -------------------------
# Magento 2 profile
# -------------------------
FROM base AS magento2
RUN install-php-extensions \
mysqli \
xsl \
soap \
bcmath \
sodium \
redis
# -------------------------
# OpenCart profile
# -------------------------
FROM base AS opencart
RUN install-php-extensions \
mysqli \
redis
# 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
ARG MODE
# production mode: direct run container on server
RUN if [ "$MODE" = "prod" ]; then \
# Enable PHP production settings
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
fi