mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-25 21:57:48 +00:00
refactor(devops): 重构 Docker 配置和目录结构
- 移除旧的 `Dockerfile` 和 `nginx.conf`,新增独立的 `frontend` 和 `backend` Dockerfile - 更新 `docker-compose.yaml`,简化服务配置并优化网络和卷挂载 - 移除 `start.sh` 和 `stop.sh` 脚本,简化部署流程 - 将环境配置文件移动到 `backend/env` 目录,并移除旧的 `.env` 文件 - 更新 `backend/app/config/setting.py` 以适配新的环境配置文件路径
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# 使用官方的 Python 3.10 镜像作为基础镜像
|
||||
FROM nginx:latest
|
||||
|
||||
# 使用 LABEL 替代 MAINTAINER
|
||||
LABEL maintainer="948080782@qq.com"
|
||||
|
||||
# 设置时区
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
# 设置容器内工作目录
|
||||
WORKDIR /home
|
||||
|
||||
# 将当前主机目录全部文件复制至容器工作目录
|
||||
COPY /home/fastapi_vue3_admin/devops/frontend/dist /usr/share/nginx/html
|
||||
|
||||
# 用本地的nginx配置文件覆盖镜像的Nginx配置
|
||||
COPY /home/fastapi_vue3_admin/devops/frontend/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
@@ -0,0 +1,51 @@
|
||||
########### 每个指令必须有分号结束。#################
|
||||
user administrator administrators; # 配置用户或组,默认为nobody nobody
|
||||
worker_processes 1; # 允许生成的进程数,默认为1
|
||||
pid /nginx/pid/nginx.pid; # 指定 Nginx 进程运行文件存放地址
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
events {
|
||||
accept_mutex on; # 设置网络连接序列化,防止惊群现象发生,默认为on
|
||||
multi_accept on; # 设置一个进程是否同时接受多个网络连接,默认为off
|
||||
use epoll; # 事件驱动模型,select|poll|kqueue|epoll|resig|/dev/poll|eventport
|
||||
worker_connections 1024; # 最大连接数,默认为512
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types; # 文件扩展名与文件类型映射表
|
||||
default_type application/octet-stream; # 默认文件类型,默认为text/plain
|
||||
|
||||
# 访问服务日志
|
||||
access_log on;
|
||||
access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
sendfile on; # 允许sendfile方式传输文件,默认为off,可以在http块、server块、location块
|
||||
|
||||
keepalive_timeout 75; # 连接超时时间,默认为75秒,可以在http、server、location块
|
||||
|
||||
# server 块
|
||||
server {
|
||||
# 监听端口
|
||||
listen 80;
|
||||
|
||||
# 服务名
|
||||
server_name frontend;
|
||||
|
||||
# 前端代理
|
||||
location / {
|
||||
root /usr/share/nginx/html; #nginx容器规定位置;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
# 后端代理
|
||||
location /api/ {
|
||||
proxy_pass http://172.18.52.77:8000;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user