构建PHP镜像
PHP内置服务器的路由脚本可以参考这个链接:使用PHP内置服务器运行WORDPRESS
FROM php:8.1.27-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& mkdir /code \
&& docker-php-ext-install mysqli
CMD [ "php", "-S", "0.0.0.0:8080", "-t", "/code", "/code/router.php" ]
配置compose
version: "3"
services:
wordpress:
build: .
volumes:
- /Users/ianzhi/Code/php/wordpress:/code
restart: always
ports:
- 8080:8080
mysql:
image: mysql:8.0.36
environment:
MYSQL_ROOT_PASSWORD: 'root'
expose:
- 3306
ports:
- 3306:3306
发表回复