Skip to content

Instantly share code, notes, and snippets.

@qolarnix
Created February 29, 2024 04:48
Show Gist options
  • Save qolarnix/1b7afa5a71d83de65b77e31bdfd25ebf to your computer and use it in GitHub Desktop.
Save qolarnix/1b7afa5a71d83de65b77e31bdfd25ebf 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"]
@qolarnix
Copy link
Author

Edits to docker-compose.yml

volumes:
- wordpress:/var/www/html
- /home/polarnix/Git:/app/private
tty: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment