update
Browse files- Dockerfile +11 -17
- runtime.txt +0 -1
- server/runtime.txt +1 -0
- server/server.py +1 -6
Dockerfile
CHANGED
@@ -9,28 +9,22 @@ RUN mkdir -p dist && npm run build
|
|
9 |
FROM python:3.10-slim
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
#
|
13 |
-
RUN
|
14 |
-
build-essential \
|
15 |
-
curl \
|
16 |
-
&& rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
-
# Install
|
19 |
-
RUN
|
20 |
-
|
|
|
|
|
21 |
|
22 |
-
# Copy Python dependencies
|
23 |
COPY server/pyproject.toml server/poetry.lock* ./
|
24 |
-
|
25 |
-
# Configure Poetry and install dependencies
|
26 |
RUN poetry config virtualenvs.create false \
|
27 |
&& poetry install --no-interaction --no-ansi --only main --no-root
|
28 |
|
29 |
-
# Copy
|
30 |
-
COPY
|
31 |
-
|
32 |
-
# Create non-root user
|
33 |
-
RUN useradd -m -u 1000 user
|
34 |
|
35 |
# Copy client build
|
36 |
COPY --from=client-build /app/dist ./static
|
@@ -50,4 +44,4 @@ USER user
|
|
50 |
EXPOSE 7860
|
51 |
|
52 |
# Start the server
|
53 |
-
CMD ["
|
|
|
9 |
FROM python:3.10-slim
|
10 |
WORKDIR /app
|
11 |
|
12 |
+
# Create non-root user
|
13 |
+
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
14 |
|
15 |
+
# Install system dependencies and poetry
|
16 |
+
RUN apt-get update && apt-get install -y \
|
17 |
+
netcat-openbsd \
|
18 |
+
&& rm -rf /var/lib/apt/lists/* \
|
19 |
+
&& pip install poetry
|
20 |
|
21 |
+
# Copy and install Python dependencies
|
22 |
COPY server/pyproject.toml server/poetry.lock* ./
|
|
|
|
|
23 |
RUN poetry config virtualenvs.create false \
|
24 |
&& poetry install --no-interaction --no-ansi --only main --no-root
|
25 |
|
26 |
+
# Copy server code
|
27 |
+
COPY server/ ./server/
|
|
|
|
|
|
|
28 |
|
29 |
# Copy client build
|
30 |
COPY --from=client-build /app/dist ./static
|
|
|
44 |
EXPOSE 7860
|
45 |
|
46 |
# Start the server
|
47 |
+
CMD ["python", "-m", "uvicorn", "server.server:app", "--host", "0.0.0.0", "--port", "7860"]
|
runtime.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
python-3.10.12
|
|
|
|
server/runtime.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
python-3.10.12
|
server/server.py
CHANGED
@@ -3,7 +3,6 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
3 |
from fastapi.staticfiles import StaticFiles
|
4 |
import os
|
5 |
from dotenv import load_dotenv
|
6 |
-
from fastapi.responses import FileResponse
|
7 |
|
8 |
# Import local modules
|
9 |
from core.game_logic import StoryGenerator
|
@@ -75,11 +74,7 @@ async def shutdown_event():
|
|
75 |
await flux_client.close()
|
76 |
|
77 |
# Mount static files (this should be after all API routes)
|
78 |
-
app.mount("/
|
79 |
-
|
80 |
-
@app.get("/{full_path:path}")
|
81 |
-
async def serve_static(full_path: str):
|
82 |
-
return FileResponse(os.path.join(STATIC_FILES_DIR, full_path if full_path else "index.html"))
|
83 |
|
84 |
if __name__ == "__main__":
|
85 |
import uvicorn
|
|
|
3 |
from fastapi.staticfiles import StaticFiles
|
4 |
import os
|
5 |
from dotenv import load_dotenv
|
|
|
6 |
|
7 |
# Import local modules
|
8 |
from core.game_logic import StoryGenerator
|
|
|
74 |
await flux_client.close()
|
75 |
|
76 |
# Mount static files (this should be after all API routes)
|
77 |
+
app.mount("/", StaticFiles(directory=STATIC_FILES_DIR, html=True), name="static")
|
|
|
|
|
|
|
|
|
78 |
|
79 |
if __name__ == "__main__":
|
80 |
import uvicorn
|