初始化仓库

This commit is contained in:
2026-02-26 15:05:17 +08:00
commit 949d963236
7 changed files with 111 additions and 0 deletions

4
.env.example Normal file
View File

@@ -0,0 +1,4 @@
DB_HOST=mariadb
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=byjdros916...

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.env
mysql/
byjd/

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
极光节点轮换项目部署脚本
## 使用方式
1. 拉取本项目
2. 拉取或手动下载 byjd 项目到本项目的根目录
3. 运行 `docker compose up -d`
## 注意事项
由于 php 官方镜像不包含必需的扩展,启动项目时会自动构建自定义 php 镜像,下载扩展和构建的速度可能非常慢。
可以考虑预构建此镜像到代码仓库的注册表,以便以后直接使用。

41
docker-compose.yaml Normal file
View File

@@ -0,0 +1,41 @@
services:
mariadb:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
volumes:
- ./mysql/data:/var/lib/mysql
ports:
- "127.0.0.1:3306:3306"
restart: unless-stopped
phpmyadmin:
image: phpmyadmin:latest
environment:
PMA_HOST: mariadb
PMA_PORT: 3306
depends_on:
- mariadb
restart: unless-stopped
php-fpm:
build:
context: ./php
dockerfile: Dockerfile
volumes:
- ./byjd:/var/www/html/byjd
depends_on:
- mariadb
restart: unless-stopped
nginx:
image: nginx:alpine
volumes:
- ./nginx/configs:/etc/nginx/conf.d:ro
- ./byjd:/var/www/html/byjd:ro
ports:
- "18701:18701"
- "18702:18702"
restart: unless-stopped

19
nginx/configs/byjd.conf Normal file
View File

@@ -0,0 +1,19 @@
server{
listen 18702;
server_name "127.0.0.1";
index index.php;
root /var/www/html/byjd;
location ~ \.php(.*)$ {
fastcgi_pass php-fpm:9000;
include fastcgi_params;
fastcgi_param PATH_INFO $1;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
}

View File

@@ -0,0 +1,26 @@
server{
listen 18701;
server_name "127.0.0.1";
# index index.php;
# root /var/www/html/phpMyAdmin;
# location ~ \.php(.*)$ {
# fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
# include fastcgi_params;
# fastcgi_param PATH_INFO $1;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# }
# location / {
# if (!-e $request_filename) {
# rewrite ^/index.php(.*)$ /index.php?s=$1 last;
# rewrite ^(.*)$ /index.php?s=$1 last;
# break;
# }
# }
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://phpmyadmin:80;
}
}

3
php/Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM php:8.3-fpm-alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN docker-php-ext-install pdo_mysql mysqli