From bcf5efb0b1714c5636bfa172595ac1850905337f Mon Sep 17 00:00:00 2001 From: Lu Ken Date: Tue, 31 Dec 2024 19:10:53 +0800 Subject: [PATCH] update Signed-off-by: Lu Ken --- Dockerfile | 9 +++++---- src/gentrade_server/main.py | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 46c5c4e..80f3061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,16 @@ FROM python:3.11 -RUN apt update -y && apt install -y python3 python3-pip git && apt clean -y +RUN apt update -y && apt install -y python3 python3-pip && apt clean -y ENV PIP_MIRROR="-i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" -ENV GENTRADE_CACHE_DIR="/app/cache/" +ENV GENTRADE_CACHE_DIR=/app/cache/ ADD . /app/GenTradeServer ADD cache /app/cache/ -RUN git clone https://github.com/TrustWiseAgent/GenTrade /app/GenTrade -ENV PYTHONPATH=/app/GenTrade/src/:/app/GenTradeServer/src/ +RUN pip install gentrade==0.0.17 + +ENV PYTHONPATH=/app/GenTradeServer/src/ VOLUME [ "/app/cache/" ] WORKDIR /app/GenTradeServer/src/ diff --git a/src/gentrade_server/main.py b/src/gentrade_server/main.py index 38b6e95..5cdc17a 100644 --- a/src/gentrade_server/main.py +++ b/src/gentrade_server/main.py @@ -1,6 +1,7 @@ """ The main entry """ +import sys import logging from contextlib import asynccontextmanager @@ -29,6 +30,13 @@ async def lifespan(_:FastAPI): yield LOG.info("Shutting Down...") +def receive_signal(signalNumber, _): + """ + Quit on Control + C + """ + LOG.info('Received Signal: %d', signalNumber) + sys.exit() + app = FastAPI() app = FastAPI(lifespan=lifespan) app.add_middleware(