feat: docker支持
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
/.svn
|
||||||
|
/.vscode
|
||||||
|
runtime
|
||||||
|
nginx.htaccess
|
||||||
|
.env
|
||||||
|
/public/install/install.lock
|
||||||
|
/extend/netdisk/pan/access_token.json
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
# 使用PHP 7.2作为基础镜像
|
||||||
|
FROM php:7.2-fpm
|
||||||
|
|
||||||
|
# 使用阿里云镜像源
|
||||||
|
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
|
||||||
|
&& sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
|
||||||
|
|
||||||
|
# 安装系统依赖
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
libpng-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
zip \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
# 安装PHP扩展
|
||||||
|
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
|
||||||
|
|
||||||
|
# 安装Composer
|
||||||
|
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# 设置工作目录
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
# 创建必要的目录
|
||||||
|
RUN mkdir -p /var/www/html/app \
|
||||||
|
&& mkdir -p /var/www/html/config \
|
||||||
|
&& mkdir -p /var/www/html/public \
|
||||||
|
&& mkdir -p /var/www/html/route \
|
||||||
|
&& mkdir -p /var/www/html/vendor \
|
||||||
|
&& mkdir -p /var/www/html/runtime
|
||||||
|
|
||||||
|
# 创建Composer缓存目录并设置权限
|
||||||
|
RUN mkdir -p /var/www/.composer/cache \
|
||||||
|
&& chown -R www-data:www-data /var/www/.composer
|
||||||
|
|
||||||
|
# 复制项目文件
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# 设置目录权限
|
||||||
|
RUN chown -R www-data:www-data /var/www/html \
|
||||||
|
&& chmod -R 755 /var/www/html \
|
||||||
|
&& chmod -R 777 /var/www/html/runtime
|
||||||
|
|
||||||
|
# 配置git安全目录
|
||||||
|
RUN git config --global --add safe.directory /var/www/html
|
||||||
|
|
||||||
|
# 切换到www-data用户并安装依赖
|
||||||
|
USER www-data
|
||||||
|
RUN composer install --no-dev --optimize-autoloader
|
||||||
|
|
||||||
|
# 切换回root用户
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# 暴露端口
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
# 启动PHP-FPM
|
||||||
|
CMD ["php-fpm"]
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "xinyue/search",
|
||||||
|
"description": "Xinyue Search - A multi-cloud disk resource search engine",
|
||||||
|
"type": "project",
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.2.5",
|
||||||
|
"topthink/framework": "^6.1.0",
|
||||||
|
"topthink/think-orm": "^2.0",
|
||||||
|
"topthink/think-filesystem": "^1.0",
|
||||||
|
"topthink/think-helper": "^3.1",
|
||||||
|
"topthink/think-cache": "^1.0",
|
||||||
|
"topthink/think-queue": "^3.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"app\\": "app"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"topthink/think-installer": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allow-plugins": {
|
||||||
|
"topthink/think-installer": true
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable"
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: xinyue-app
|
||||||
|
restart: unless-stopped
|
||||||
|
working_dir: /var/www/html
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html
|
||||||
|
networks:
|
||||||
|
- xinyue-network
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
container_name: xinyue-nginx
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8009:80"
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www/html
|
||||||
|
- ./docker/nginx:/etc/nginx/conf.d
|
||||||
|
networks:
|
||||||
|
- xinyue-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
xinyue-network:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
dbdata:
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
index index.php index.html;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
root /var/www/html/public;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user