Merge pull request #10 from 1014TaoTao/dev

chore: 更新环境变量和Docker配置
This commit is contained in:
1014TaoTao
2025-05-17 03:45:08 +08:00
committed by GitHub
8 changed files with 14 additions and 15 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ ENVIRONMENT = "dev"
# 服务器配置 # 服务器配置
SERVER_HOST = '0.0.0.0' # 允许访问的IP地址 SERVER_HOST = '0.0.0.0' # 允许访问的IP地址
SERVER_PORT = 8000 # 服务端口 SERVER_PORT = 8001 # 服务端口
RELOAD = True # 是否自动重启 RELOAD = True # 是否自动重启
WORKERS = 1 # 启动进程数 WORKERS = 1 # 启动进程数
FACTORY = True # 是否使用异步模式 FACTORY = True # 是否使用异步模式
+2 -2
View File
@@ -5,8 +5,8 @@
ENVIRONMENT = "prod" ENVIRONMENT = "prod"
# 服务器配置 # 服务器配置
SERVER_HOST = '172.18.52.77' # 允许访问的IP地址 SERVER_HOST = '0.0.0.0' # 允许访问的IP地址
SERVER_PORT = 8000 # 服务端口 SERVER_PORT = 8001 # 服务端口
RELOAD = False # 是否自动重启 RELOAD = False # 是否自动重启
WORKERS = 1 # 启动进程数 WORKERS = 1 # 启动进程数
FACTORY = True # 是否使用异步模式 FACTORY = True # 是否使用异步模式
Executable → Regular
View File
+2 -2
View File
@@ -11,10 +11,10 @@ ENV TZ Asia/Shanghai
WORKDIR /home WORKDIR /home
# 将当前主机目录全部文件复制至容器工作目录 # 将当前主机目录全部文件复制至容器工作目录
COPY /home/fastapi_vue3_admin/backend . COPY ../backend .
# 安装依赖 # 安装依赖
RUN pip install --no-cache-dir -r ./backend/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple RUN pip install --no-cache-dir -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 运行应用 # 运行应用
CMD ["python", "main.py", "run", "--env=prod"] CMD ["python", "main.py", "run", "--env=prod"]
+4 -4
View File
@@ -1,4 +1,4 @@
version: "3.0" version: "3.10"
# 应用服务 # 应用服务
services: services:
@@ -42,11 +42,11 @@ services:
container_name: backend container_name: backend
# 构建镜像 # 构建镜像
build: build:
context: ./backend context: ..
dockerfile: Dockerfile dockerfile: devops/backend/Dockerfile
# 端口映射 # 端口映射
ports: ports:
- "8000:8000" - "8001:8001"
volumes: volumes:
- /home/backend/static:/home/backend/static - /home/backend/static:/home/backend/static
- /home/backend/logs:/home/backend/logs - /home/backend/logs:/home/backend/logs
+2 -2
View File
@@ -11,10 +11,10 @@ ENV TZ Asia/Shanghai
WORKDIR /home WORKDIR /home
# 将当前主机目录全部文件复制至容器工作目录 # 将当前主机目录全部文件复制至容器工作目录
COPY /home/fastapi_vue3_admin/devops/frontend/dist /usr/share/nginx/html COPY ./dist /usr/share/nginx/html
# 用本地的nginx配置文件覆盖镜像的Nginx配置 # 用本地的nginx配置文件覆盖镜像的Nginx配置
COPY /home/fastapi_vue3_admin/devops/frontend/nginx.conf /etc/nginx/nginx.conf COPY ./nginx.conf /etc/nginx/nginx.conf
# 暴露端口 # 暴露端口
EXPOSE 80 EXPOSE 80
+2 -3
View File
@@ -1,6 +1,5 @@
########### 每个指令必须有分号结束。################# ########### 每个指令必须有分号结束。#################
user administrator administrators; # 配置用户或组,默认为nobody nobody worker_processes 1; # 允许生成的进程数,默认为1:
worker_processes 1; # 允许生成的进程数,默认为1
pid /nginx/pid/nginx.pid; # 指定 Nginx 进程运行文件存放地址 pid /nginx/pid/nginx.pid; # 指定 Nginx 进程运行文件存放地址
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log warn;
@@ -18,7 +17,7 @@ http {
# 访问服务日志 # 访问服务日志
access_log on; access_log on;
access_log /var/log/nginx/host.access.log main; access_log /var/log/nginx/host.access.log info;
sendfile on; # 允许sendfile方式传输文件,默认为off,可以在http块、server块、location块 sendfile on; # 允许sendfile方式传输文件,默认为off,可以在http块、server块、location块
+1 -1
View File
@@ -10,7 +10,7 @@ VITE_APP_TITLE=开发环境
VITE_APP_BASE_API=/api/v1 VITE_APP_BASE_API=/api/v1
# 网络请求公用地址 # 网络请求公用地址
VITE_API_BASE_URL=http://localhost:8000 VITE_API_BASE_URL=http://localhost:8001
# 请求超时时间 # 请求超时时间
VITE_TIMEOUT=10000 VITE_TIMEOUT=10000