Skip to content

Instantly share code, notes, and snippets.

@DarkGhostHunter
Created August 27, 2025 19:38
Show Gist options
  • Save DarkGhostHunter/3de5b7d566875399473bfcbe95cf79b4 to your computer and use it in GitHub Desktop.
Save DarkGhostHunter/3de5b7d566875399473bfcbe95cf79b4 to your computer and use it in GitHub Desktop.
Dockerfile for FrankenPHP on Laravel Sail for Development
:8108 {
reverse_proxy typesense:8108
}
services:
laravel.test:
build:
context: './docker/8.4'
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: 'sail-8.4/app'
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '2019:2019'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
- '443:443'
- '443:443/udp'
- '${FORWARD_TYPESENSE_PORT:-8108}:8108'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
SUPERVISOR_PHP_COMMAND: "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:frankenphp --host=0.0.0.0 --admin-port=2019 --port='${APP_PORT:-80}' --caddyfile=/app/Caddyfile.development"
XDG_CONFIG_HOME: /app/xdg/config
XDG_DATA_HOME: /app/xdg/data
volumes:
- '.:/app'
networks:
- sail
depends_on:
- pgsql
- redis
- typesense
# Use the latest FrankenPHP image. You may set "*-php8.4-bookworm" as a custom version if needed.
FROM dunglas/frankenphp:latest
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG POSTGRES_VERSION=17
ARG MYSQL_CLIENT="default-mysql-client"
# Set working dir and environment
WORKDIR /app # FrankenPHP uses /app/public by default; adjust later if needed
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Should be overridden in docker-composer.yaml
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
ENV FRANKENPHP_CONFIG="worker ./public/index.php"
# Set timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Disable ATP downloading from the cache and retry under proxies
RUN echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom \
&& echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
# Configure php.ini for development
RUN cp "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
# Install missing PHP extensions from FrankenPHP
RUN install-php-extensions \
pgsql \
gd \
mongodb \
imap \
zip \
bcmath \
soap \
intl \
ldap \
msgpack \
igbinary \
redis \
memcached \
pcov \
imagick \
xdebug
# Install utilities (node, bun, pnpm, deno, composer, yarn, mysql/postgres clients)
RUN apt-get update \
# Common utilities for the container \
&& apt-get install -y \
gnupg \
gosu \
curl \
ca-certificates \
zip \
unzip \
git \
supervisor \
sqlite3 \
libcap2-bin \
libpng-dev \
python3 \
dnsutils \
librsvg2-bin \
fswatch \
ffmpeg \
nano \
# Install composer using the original installer \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
# Install the keys to install node \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list \
# Proceed to install node and friends \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm pnpm bun \
&& npm install -g yarn \
# Install the keys for installing PostgreSQL client \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list \
# Install the database clients \
&& apt-get update \
&& apt-get install -y $MYSQL_CLIENT postgresql-client-$POSTGRES_VERSION \
# Clean up \
&& apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Playwright dependencies
RUN npx playwright install-deps
# Allow FrankenPHP to be bound to ports 80/443
RUN setcap "cap_net_bind_service=+ep" /usr/local/bin/frankenphp
# Create non-root user
RUN groupadd --force -g ${WWWGROUP:-1000} sail \
&& useradd -ms /bin/bash --no-user-group -g ${WWWGROUP:-1000} -u 1337 sail \
&& chown -R sail:sail /app
# Allow git to treat the app directory as safe
RUN git config --global --add safe.directory /app
# Copy application code and config
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment