tfrere commited on
Commit
f370e63
·
1 Parent(s): af73633
Dockerfile CHANGED
@@ -30,7 +30,9 @@ COPY --from=client-build /app/dist ./static
30
 
31
  # Environment variables
32
  ENV API_HOST=0.0.0.0 \
33
- API_PORT=7860
 
 
34
 
35
  # Create cache directory and set permissions
36
  RUN mkdir -p /app/cache && chown -R user:user /app/cache
 
30
 
31
  # Environment variables
32
  ENV API_HOST=0.0.0.0 \
33
+ API_PORT=7860 \
34
+ STATIC_FILES_DIR=static \
35
+ DOCKER_ENV=true
36
 
37
  # Create cache directory and set permissions
38
  RUN mkdir -p /app/cache && chown -R user:user /app/cache
server/{game_logic.py → game/game_logic.py} RENAMED
File without changes
server/server.py CHANGED
@@ -5,7 +5,12 @@ from pydantic import BaseModel
5
  from typing import List, Optional
6
  import os
7
  from dotenv import load_dotenv
8
- from game_logic import GameState, StoryGenerator, MAX_RADIATION
 
 
 
 
 
9
 
10
  # Load environment variables
11
  load_dotenv()
@@ -13,6 +18,7 @@ load_dotenv()
13
  # API configuration
14
  API_HOST = os.getenv("API_HOST", "0.0.0.0")
15
  API_PORT = int(os.getenv("API_PORT", "8000"))
 
16
 
17
  app = FastAPI(title="Echoes of Influence")
18
 
@@ -101,8 +107,8 @@ async def chat_endpoint(chat_message: ChatMessage):
101
  raise HTTPException(status_code=500, detail=str(e))
102
 
103
  # Mount static files (this should be after all API routes)
104
- app.mount("/", StaticFiles(directory="../client/dist", html=True), name="static")
105
 
106
  if __name__ == "__main__":
107
  import uvicorn
108
- uvicorn.run("server:app", host=API_HOST, port=API_PORT, reload=True)
 
5
  from typing import List, Optional
6
  import os
7
  from dotenv import load_dotenv
8
+
9
+ # Choose import based on environment
10
+ if os.getenv("DOCKER_ENV"):
11
+ from server.game.game_logic import GameState, StoryGenerator, MAX_RADIATION
12
+ else:
13
+ from game.game_logic import GameState, StoryGenerator, MAX_RADIATION
14
 
15
  # Load environment variables
16
  load_dotenv()
 
18
  # API configuration
19
  API_HOST = os.getenv("API_HOST", "0.0.0.0")
20
  API_PORT = int(os.getenv("API_PORT", "8000"))
21
+ STATIC_FILES_DIR = os.getenv("STATIC_FILES_DIR", "../client/dist")
22
 
23
  app = FastAPI(title="Echoes of Influence")
24
 
 
107
  raise HTTPException(status_code=500, detail=str(e))
108
 
109
  # Mount static files (this should be after all API routes)
110
+ app.mount("/", StaticFiles(directory=STATIC_FILES_DIR, html=True), name="static")
111
 
112
  if __name__ == "__main__":
113
  import uvicorn
114
+ uvicorn.run("server.server:app", host=API_HOST, port=API_PORT, reload=True)