feat(config): 添加环境变量配置支持动态镜像和端口设置
- 在 .env.example 中添加 SERVER_BASE_IMAGE、SERVER_INTERNAL_PORT 等配置项 - 添加前端构建相关的 NODE_IMAGE 和 NGINX_IMAGE 配置 - 添加客户端 H5 和原生应用的 API 基础路径配置 - 支持动态端口配置以提高部署灵活性 feat(docker): 更新 Dockerfile 使用参数化镜像和端口配置 - 修改 server/Dockerfile 支持动态基础镜像和内部端口 - 更新 admin-web/Dockerfile 使用参数化镜像配置 - 修改 clients/Dockerfile 支持客户端多环境配置参数 - 所有 Dockerfile 现在使用 ARG 参数进行灵活配置 feat(nginx): 优化 Nginx 配置支持动态端口代理 - 更新 Nginx 配置文件使用环境变量定义监听端口 - 配置三个独立的服务端口分别处理客户端、管理后台和服务器API - 添加完整的代理头信息设置以支持正确的请求转发 - 使用 Nginx 环境变量实现灵活的服务间通信 feat(deploy): 完善 docker-compose.yml 的环境变量集成 - 更新 docker-compose.yml 文件以使用新的环境变量配置 - 配置服务健康检查使用动态端口 - 设置 Nginx 容器环境变量以支持模板化配置 - 修复服务间通信端口使用环境变量替代硬编码值
This commit is contained in:
@@ -19,6 +19,8 @@ S3_SECRET_KEY=change-me-minio-password
|
|||||||
S3_BUCKET=ciyuan-viewfinder
|
S3_BUCKET=ciyuan-viewfinder
|
||||||
|
|
||||||
# Server
|
# Server
|
||||||
|
SERVER_BASE_IMAGE=python:3.12-slim
|
||||||
|
SERVER_INTERNAL_PORT=8000
|
||||||
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
|
PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn
|
||||||
PIP_DEFAULT_TIMEOUT=120
|
PIP_DEFAULT_TIMEOUT=120
|
||||||
@@ -34,9 +36,23 @@ LOG_LEVEL=INFO
|
|||||||
LOG_JSON=false
|
LOG_JSON=false
|
||||||
|
|
||||||
# Frontend build
|
# Frontend build
|
||||||
|
ADMIN_WEB_NODE_IMAGE=node:20-alpine
|
||||||
|
ADMIN_WEB_NGINX_IMAGE=nginx:1.27-alpine
|
||||||
|
ADMIN_WEB_INTERNAL_PORT=80
|
||||||
VITE_API_BASE=/api/v1
|
VITE_API_BASE=/api/v1
|
||||||
|
CLIENTS_NODE_IMAGE=node:20-alpine
|
||||||
|
CLIENTS_NGINX_IMAGE=nginx:1.27-alpine
|
||||||
|
CLIENTS_INTERNAL_PORT=80
|
||||||
|
VITE_CLIENT_H5_API_BASE=/api/v1
|
||||||
|
VITE_CLIENT_H5_SERVER_ORIGIN=
|
||||||
|
VITE_CLIENT_NATIVE_API_BASE=http://10.0.10.11:8000/api/v1
|
||||||
|
VITE_CLIENT_NATIVE_SERVER_ORIGIN=http://10.0.10.11:8000
|
||||||
|
|
||||||
# Nginx host ports
|
# Nginx host ports
|
||||||
NGINX_IMAGE=nginx:1.27-alpine
|
NGINX_IMAGE=nginx:1.27-alpine
|
||||||
|
NGINX_CLIENT_INTERNAL_PORT=80
|
||||||
|
NGINX_ADMIN_INTERNAL_PORT=81
|
||||||
|
NGINX_SERVER_INTERNAL_PORT=82
|
||||||
CLIENT_WEB_PORT=5173
|
CLIENT_WEB_PORT=5173
|
||||||
ADMIN_WEB_PORT=5174
|
ADMIN_WEB_PORT=5174
|
||||||
|
SERVER_WEB_PORT=8000
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
FROM node:20-alpine AS build
|
ARG ADMIN_WEB_NODE_IMAGE=node:20-alpine
|
||||||
|
ARG ADMIN_WEB_NGINX_IMAGE=nginx:1.27-alpine
|
||||||
|
|
||||||
|
FROM ${ADMIN_WEB_NODE_IMAGE} AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -11,7 +14,7 @@ RUN npm ci
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
FROM ${ADMIN_WEB_NGINX_IMAGE}
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|||||||
+15
-2
@@ -1,15 +1,28 @@
|
|||||||
FROM node:20-alpine AS build
|
ARG CLIENTS_NODE_IMAGE=node:20-alpine
|
||||||
|
ARG CLIENTS_NGINX_IMAGE=nginx:1.27-alpine
|
||||||
|
|
||||||
|
FROM ${CLIENTS_NODE_IMAGE} AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV UNI_INPUT_DIR=/app
|
ENV UNI_INPUT_DIR=/app
|
||||||
|
|
||||||
|
ARG VITE_CLIENT_H5_API_BASE=/api/v1
|
||||||
|
ARG VITE_CLIENT_H5_SERVER_ORIGIN=
|
||||||
|
ARG VITE_CLIENT_NATIVE_API_BASE=http://10.0.10.11:8000/api/v1
|
||||||
|
ARG VITE_CLIENT_NATIVE_SERVER_ORIGIN=http://10.0.10.11:8000
|
||||||
|
|
||||||
|
ENV VITE_CLIENT_H5_API_BASE=${VITE_CLIENT_H5_API_BASE} \
|
||||||
|
VITE_CLIENT_H5_SERVER_ORIGIN=${VITE_CLIENT_H5_SERVER_ORIGIN} \
|
||||||
|
VITE_CLIENT_NATIVE_API_BASE=${VITE_CLIENT_NATIVE_API_BASE} \
|
||||||
|
VITE_CLIENT_NATIVE_SERVER_ORIGIN=${VITE_CLIENT_NATIVE_SERVER_ORIGIN}
|
||||||
|
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
RUN npm install --legacy-peer-deps
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build:h5
|
RUN npm run build:h5
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
FROM ${CLIENTS_NGINX_IMAGE}
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
COPY --from=build /app/dist/build/h5 /usr/share/nginx/html
|
COPY --from=build /app/dist/build/h5 /usr/share/nginx/html
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
const API_BASE = "/api/v1";
|
const API_BASE = import.meta.env.VITE_CLIENT_H5_API_BASE || "/api/v1";
|
||||||
const SERVER_ORIGIN = window.location.origin;
|
const SERVER_ORIGIN =
|
||||||
|
import.meta.env.VITE_CLIENT_H5_SERVER_ORIGIN || window.location.origin;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
const API_BASE = "http://10.0.10.11:8000/api/v1";
|
const API_BASE =
|
||||||
const SERVER_ORIGIN = "http://10.0.10.11:8000";
|
import.meta.env.VITE_CLIENT_NATIVE_API_BASE || "http://10.0.10.11:8000/api/v1";
|
||||||
|
const SERVER_ORIGIN =
|
||||||
|
import.meta.env.VITE_CLIENT_NATIVE_SERVER_ORIGIN || "http://10.0.10.11:8000";
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
export { API_BASE, SERVER_ORIGIN };
|
export { API_BASE, SERVER_ORIGIN };
|
||||||
|
|||||||
+27
-7
@@ -60,11 +60,14 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./server
|
context: ./server
|
||||||
args:
|
args:
|
||||||
|
SERVER_BASE_IMAGE: "${SERVER_BASE_IMAGE}"
|
||||||
PIP_INDEX_URL: "${PIP_INDEX_URL}"
|
PIP_INDEX_URL: "${PIP_INDEX_URL}"
|
||||||
PIP_TRUSTED_HOST: "${PIP_TRUSTED_HOST}"
|
PIP_TRUSTED_HOST: "${PIP_TRUSTED_HOST}"
|
||||||
PIP_DEFAULT_TIMEOUT: "${PIP_DEFAULT_TIMEOUT}"
|
PIP_DEFAULT_TIMEOUT: "${PIP_DEFAULT_TIMEOUT}"
|
||||||
|
SERVER_INTERNAL_PORT: "${SERVER_INTERNAL_PORT}"
|
||||||
container_name: ciyuan-server
|
container_name: ciyuan-server
|
||||||
environment:
|
environment:
|
||||||
|
SERVER_INTERNAL_PORT: "${SERVER_INTERNAL_PORT}"
|
||||||
DATABASE_URL: "${DATABASE_URL}"
|
DATABASE_URL: "${DATABASE_URL}"
|
||||||
DATABASE_URL_SYNC: "${DATABASE_URL_SYNC}"
|
DATABASE_URL_SYNC: "${DATABASE_URL_SYNC}"
|
||||||
REDIS_URL: "${REDIS_URL}"
|
REDIS_URL: "${REDIS_URL}"
|
||||||
@@ -81,7 +84,7 @@ services:
|
|||||||
LOG_LEVEL: "${LOG_LEVEL}"
|
LOG_LEVEL: "${LOG_LEVEL}"
|
||||||
LOG_JSON: "${LOG_JSON}"
|
LOG_JSON: "${LOG_JSON}"
|
||||||
expose:
|
expose:
|
||||||
- "8000"
|
- "${SERVER_INTERNAL_PORT}"
|
||||||
volumes:
|
volumes:
|
||||||
- server_uploads:/app/uploads
|
- server_uploads:/app/uploads
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -97,7 +100,7 @@ services:
|
|||||||
"CMD",
|
"CMD",
|
||||||
"python",
|
"python",
|
||||||
"-c",
|
"-c",
|
||||||
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/', timeout=5)",
|
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:${SERVER_INTERNAL_PORT}/', timeout=5)",
|
||||||
]
|
]
|
||||||
interval: 15s
|
interval: 15s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
@@ -111,10 +114,12 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./admin-web
|
context: ./admin-web
|
||||||
args:
|
args:
|
||||||
|
ADMIN_WEB_NODE_IMAGE: "${ADMIN_WEB_NODE_IMAGE}"
|
||||||
|
ADMIN_WEB_NGINX_IMAGE: "${ADMIN_WEB_NGINX_IMAGE}"
|
||||||
VITE_API_BASE: "${VITE_API_BASE}"
|
VITE_API_BASE: "${VITE_API_BASE}"
|
||||||
container_name: ciyuan-admin-web
|
container_name: ciyuan-admin-web
|
||||||
expose:
|
expose:
|
||||||
- "80"
|
- "${ADMIN_WEB_INTERNAL_PORT}"
|
||||||
depends_on:
|
depends_on:
|
||||||
server:
|
server:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -125,9 +130,16 @@ services:
|
|||||||
clients:
|
clients:
|
||||||
build:
|
build:
|
||||||
context: ./clients
|
context: ./clients
|
||||||
|
args:
|
||||||
|
CLIENTS_NODE_IMAGE: "${CLIENTS_NODE_IMAGE}"
|
||||||
|
CLIENTS_NGINX_IMAGE: "${CLIENTS_NGINX_IMAGE}"
|
||||||
|
VITE_CLIENT_H5_API_BASE: "${VITE_CLIENT_H5_API_BASE}"
|
||||||
|
VITE_CLIENT_H5_SERVER_ORIGIN: "${VITE_CLIENT_H5_SERVER_ORIGIN}"
|
||||||
|
VITE_CLIENT_NATIVE_API_BASE: "${VITE_CLIENT_NATIVE_API_BASE}"
|
||||||
|
VITE_CLIENT_NATIVE_SERVER_ORIGIN: "${VITE_CLIENT_NATIVE_SERVER_ORIGIN}"
|
||||||
container_name: ciyuan-clients
|
container_name: ciyuan-clients
|
||||||
expose:
|
expose:
|
||||||
- "80"
|
- "${CLIENTS_INTERNAL_PORT}"
|
||||||
depends_on:
|
depends_on:
|
||||||
server:
|
server:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -138,11 +150,19 @@ services:
|
|||||||
nginx:
|
nginx:
|
||||||
image: "${NGINX_IMAGE}"
|
image: "${NGINX_IMAGE}"
|
||||||
container_name: ciyuan-nginx
|
container_name: ciyuan-nginx
|
||||||
|
environment:
|
||||||
|
NGINX_CLIENT_INTERNAL_PORT: "${NGINX_CLIENT_INTERNAL_PORT}"
|
||||||
|
NGINX_ADMIN_INTERNAL_PORT: "${NGINX_ADMIN_INTERNAL_PORT}"
|
||||||
|
NGINX_SERVER_INTERNAL_PORT: "${NGINX_SERVER_INTERNAL_PORT}"
|
||||||
|
SERVER_INTERNAL_PORT: "${SERVER_INTERNAL_PORT}"
|
||||||
|
CLIENTS_INTERNAL_PORT: "${CLIENTS_INTERNAL_PORT}"
|
||||||
|
ADMIN_WEB_INTERNAL_PORT: "${ADMIN_WEB_INTERNAL_PORT}"
|
||||||
ports:
|
ports:
|
||||||
- "${CLIENT_WEB_PORT}:80"
|
- "${CLIENT_WEB_PORT}:${NGINX_CLIENT_INTERNAL_PORT}"
|
||||||
- "${ADMIN_WEB_PORT}:81"
|
- "${ADMIN_WEB_PORT}:${NGINX_ADMIN_INTERNAL_PORT}"
|
||||||
|
- "${SERVER_WEB_PORT}:${NGINX_SERVER_INTERNAL_PORT}"
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./docker/nginx/default.conf:/etc/nginx/templates/default.conf.template:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
server:
|
server:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
+28
-14
@@ -1,9 +1,9 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen ${NGINX_CLIENT_INTERNAL_PORT};
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://server:8000/api/;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/api/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -12,13 +12,13 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /uploads/ {
|
location /uploads/ {
|
||||||
proxy_pass http://server:8000/uploads/;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/uploads/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /docs {
|
location = /docs {
|
||||||
proxy_pass http://server:8000/docs;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/docs;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -27,7 +27,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location = /redoc {
|
location = /redoc {
|
||||||
proxy_pass http://server:8000/redoc;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/redoc;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -36,7 +36,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location = /openapi.json {
|
location = /openapi.json {
|
||||||
proxy_pass http://server:8000/openapi.json;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/openapi.json;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -45,7 +45,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://clients:80;
|
proxy_pass http://clients:${CLIENTS_INTERNAL_PORT};
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -55,11 +55,11 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 81;
|
listen ${NGINX_ADMIN_INTERNAL_PORT};
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://server:8000/api/;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/api/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -68,13 +68,13 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /uploads/ {
|
location /uploads/ {
|
||||||
proxy_pass http://server:8000/uploads/;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/uploads/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /docs {
|
location = /docs {
|
||||||
proxy_pass http://server:8000/docs;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/docs;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -83,7 +83,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location = /redoc {
|
location = /redoc {
|
||||||
proxy_pass http://server:8000/redoc;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/redoc;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -92,7 +92,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location = /openapi.json {
|
location = /openapi.json {
|
||||||
proxy_pass http://server:8000/openapi.json;
|
proxy_pass http://server:${SERVER_INTERNAL_PORT}/openapi.json;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -101,7 +101,21 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://admin-web:80;
|
proxy_pass http://admin-web:${ADMIN_WEB_INTERNAL_PORT};
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
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_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen ${NGINX_SERVER_INTERNAL_PORT};
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://server:${SERVER_INTERNAL_PORT};
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
+7
-4
@@ -1,4 +1,5 @@
|
|||||||
FROM python:3.12-slim
|
ARG SERVER_BASE_IMAGE=python:3.12-slim
|
||||||
|
FROM ${SERVER_BASE_IMAGE}
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
@@ -7,10 +8,12 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|||||||
ARG PIP_INDEX_URL
|
ARG PIP_INDEX_URL
|
||||||
ARG PIP_TRUSTED_HOST
|
ARG PIP_TRUSTED_HOST
|
||||||
ARG PIP_DEFAULT_TIMEOUT=120
|
ARG PIP_DEFAULT_TIMEOUT=120
|
||||||
|
ARG SERVER_INTERNAL_PORT=8000
|
||||||
|
|
||||||
ENV PIP_INDEX_URL=${PIP_INDEX_URL} \
|
ENV PIP_INDEX_URL=${PIP_INDEX_URL} \
|
||||||
PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST} \
|
PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST} \
|
||||||
PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT}
|
PIP_DEFAULT_TIMEOUT=${PIP_DEFAULT_TIMEOUT} \
|
||||||
|
SERVER_INTERNAL_PORT=${SERVER_INTERNAL_PORT}
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -19,6 +22,6 @@ RUN pip install -r requirements.txt
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE ${SERVER_INTERNAL_PORT}
|
||||||
|
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${SERVER_INTERNAL_PORT}"]
|
||||||
|
|||||||
Reference in New Issue
Block a user