-
-
Save fhferreira/fa8e9339bf5bc9e98dcc76c42fb62266 to your computer and use it in GitHub Desktop.
Franken PHP Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base image with PHP and FrankenPHP | |
FROM dunglas/frankenphp:1-php8.3 AS frankenphp | |
RUN apt-get update && apt-get install -y zip libzip-dev libpq-dev libicu-dev wget acl curl | |
RUN docker-php-ext-install sockets zip | |
RUN docker-php-ext-configure zip | |
RUN docker-php-ext-install pgsql pdo_pgsql intl | |
ENV SERVER_NAME my_app | |
ENV FRANKENPHP_CONFIG "worker ./public/index.php" | |
ENV APP_RUNTIME Runtime\\FrankenPhpSymfony\\Runtime | |
# Set working directory | |
WORKDIR /my_app/app | |
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer | |
# Copy composer files and install dependencies | |
COPY composer.json composer.lock ./ | |
RUN composer install --no-scripts --no-interaction --no-autoloader --no-ansi | |
RUN composer dump-autoload --optimize --no-ansi && composer clear-cache --no-ansi | |
# Copy Symfony app files | |
COPY . . | |
# Define the build argument (DATABASE_URL) to build Symfony cache | |
ARG DATABASE_URL | |
ENV DATABASE_URL=${DATABASE_URL} | |
RUN php bin/console cache:warmup | |
# Copy Caddyfile for configuration | |
COPY ./Caddyfile /etc/caddy/Caddyfile | |
# Expose port 80 | |
EXPOSE 80 | |
# Run FrankenPHP with Caddy configuration | |
CMD frankenphp run --config /etc/caddy/Caddyfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment