Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
Expand Down
8 changes: 8 additions & 0 deletions src/gentrade_server/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
The main entry
"""
import sys
import logging
from contextlib import asynccontextmanager

Expand Down Expand Up @@ -29,6 +30,13 @@ async def lifespan(_:FastAPI):
yield
LOG.info("Shutting Down...")

def receive_signal(number, _):
"""
Quit on Control + C
"""
LOG.info('Received Signal: %d', number)
sys.exit()

app = FastAPI()
app = FastAPI(lifespan=lifespan)
app.add_middleware(
Expand Down
Loading