From 10d0f5bad8f7e7cdec3faf074cb87b7b5a2d2d43 Mon Sep 17 00:00:00 2001 From: sophie <16087569+sophie_liang@user.noreply.gitee.com> Date: Tue, 12 May 2026 18:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=B1=82=E4=BF=9D=E8=AF=81Or?= =?UTF-8?q?acle=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/Dockerfile | 6 +++++- docker-compose.yml | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index da38204c..5280db82 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12-slim-bookworm +FROM python:3.12-slim-bookworm WORKDIR /app @@ -15,6 +15,9 @@ RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . +ENV ORACLE_HOME=/app/oracle_client/instantclient_19_31 +ENV LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client:${LD_LIBRARY_PATH} + # Expose port 5000 EXPOSE 5000 @@ -22,3 +25,4 @@ EXPOSE 5000 # Start Gunicorn # Using the config file we created earlier CMD ["gunicorn", "-c", "deploy/gunicorn_config.py", "run:app"] + diff --git a/docker-compose.yml b/docker-compose.yml index 376f1ce5..7be94982 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -services: +services: # ============================================================================== # hxops-backend: Flask 后端服务 (端口: 5000) # ============================================================================== @@ -18,6 +18,8 @@ services: - FLASK_APP=${FLASK_APP:-run.py} - FLASK_ENV=${FLASK_ENV:-production} - ORACLE_CLIENT_LIB_DIR=${ORACLE_CLIENT_LIB_DIR:-/app/oracle_client} + - ORACLE_HOME=/app/oracle_client/instantclient_19_31 + - LD_LIBRARY_PATH=/app/oracle_client/instantclient_19_31:/app/oracle_client # 允许容器访问宿主机服务 (如数据库) extra_hosts: - "host.docker.internal:host-gateway" @@ -59,3 +61,4 @@ networks: ai-platform: name: ai-platform driver: bridge +