Skip to content

Instantly share code, notes, and snippets.

@heartshare
Forked from qolarnix/Dockerfile
Created August 26, 2024 06:51
Show Gist options
  • Save heartshare/0561621ceb2f225b0201b231c8efc6d8 to your computer and use it in GitHub Desktop.
Save heartshare/0561621ceb2f225b0201b231c8efc6d8 to your computer and use it in GitHub Desktop.
Dockerfile for frankenphp local wp
FROM dunglas/frankenphp:latest-php8.2
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
RUN install-php-extensions \
bcmath \
exif \
gd \
intl \
mysqli \
zip \
imagick \
opcache
COPY --from=wordpress /usr/local/etc/php/conf.d/* /usr/local/etc/php/conf.d/
COPY --from=wordpress /usr/local/bin/docker-entrypoint.sh /usr/local/bin/
COPY --from=wordpress --chown=root:root /usr/src/wordpress /usr/src/wordpress
WORKDIR /var/www/html
VOLUME /var/www/html
RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
RUN sed -i 's/upload_max_filesize = .*/upload_max_filesize = 256M/' $PHP_INI_DIR/php.ini \
&& sed -i 's/post_max_size = .*/post_max_size = 256M/' $PHP_INI_DIR/php.ini
USER root
RUN ln -s /app/private/projects/simpledmca/theme/sdm-theme /var/www/html/wp-content/themes/sdm-theme
USER www-data
ARG USER=www-data
RUN chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy
RUN sed -i \
-e 's/\[ "$1" = '\''php-fpm'\'' \]/\[\[ "$1" == frankenphp* \]\]/g' \
-e 's/php-fpm/frankenphp/g' \
/usr/local/bin/docker-entrypoint.sh
RUN sed -i \
-e 's#root \* public/#root \* /var/www/html/#g' \
/etc/caddy/Caddyfile
USER ${USER}
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
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