mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2026-02-21 15:31:12 +08:00
添加容器化
This commit is contained in:
parent
5e25fb2726
commit
45c0f0f0b5
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- .:/var/www/html # 将当前目录挂载到容器
|
||||
command: php think run # 启动 PHP 内置服务器
|
||||
ports:
|
||||
- "8000:8000" # 映射容器端口到主机端口
|
||||
22
dockerfile
Normal file
22
dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
# 使用 PHP 8.1 镜像
|
||||
FROM php:8.1-cli
|
||||
|
||||
# 安装 OPcache 扩展
|
||||
RUN apt-get update && apt-get install -y libzip-dev \
|
||||
&& docker-php-ext-install opcache \
|
||||
&& docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
# 拷贝项目文件到容器
|
||||
COPY . /var/www/html/
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /var/www/html/
|
||||
|
||||
# 安装 Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# 安装项目依赖
|
||||
RUN composer install --no-interaction
|
||||
|
||||
# 配置 OPcache
|
||||
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
Loading…
Reference in New Issue
Block a user