# syntax=docker/dockerfile:1.5
# Amicron Platform — Plugin Development Web Container
# PHP 8.4 + Apache + Firebird extension + Node.js 22 + pnpm
#
# Based on webdevops/php-apache-dev for Xdebug + Apache convenience.
# Replaces the outdated Dockerfile (PHP 8.1, Node 18, Yarn).

FROM webdevops/php-apache-dev:8.4

# ── System dependencies ────────────────────────────────────────────────────────
RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    software-properties-common \
    firebird-dev \
    git \
    unzip \
 && rm -rf /var/lib/apt/lists/*

# ── PHP Firebird (interbase) extension ────────────────────────────────────────
# Clone the satware php-firebird extension fork and compile it.
RUN docker-php-source extract \
 && git clone --branch v12.0.0 --depth 1 \
    https://github.com/satwareAG/php-firebird.git \
    /usr/src/php/ext/interbase \
 && docker-php-ext-install interbase \
 && docker-php-source delete

# ── Node.js 22 LTS ────────────────────────────────────────────────────────────
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
 && apt-get install -y --no-install-recommends nodejs \
 && rm -rf /var/lib/apt/lists/*

# ── pnpm (replaces Yarn) ──────────────────────────────────────────────────────
RUN corepack enable \
 && corepack prepare pnpm@latest --activate

# ── Xdebug (opt-in via environment variables) ─────────────────────────────────
# Enable by setting these env vars in docker-compose.yml:
#   XDEBUG_MODE=debug
#   XDEBUG_START_WITH_REQUEST=yes
#   XDEBUG_CLIENT_HOST=host.docker.internal
# ENV XDEBUG_MODE=debug
# ENV XDEBUG_START_WITH_REQUEST=yes
# ENV XDEBUG_CLIENT_HOST=host.docker.internal
