Spaces:
Running
Running
Upload 10 files
Browse files- Dockerfile +20 -2
- main.py +5 -1
Dockerfile
CHANGED
@@ -2,10 +2,28 @@ FROM python:3.10-slim
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
COPY requirements.txt .
|
6 |
|
7 |
-
|
|
|
|
|
|
|
8 |
|
|
|
9 |
COPY . .
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Install system dependencies
|
6 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
7 |
+
build-essential \
|
8 |
+
sqlite3 \
|
9 |
+
&& rm -rf /var/lib/apt/lists/*
|
10 |
+
|
11 |
+
# Copy requirements first for better caching
|
12 |
COPY requirements.txt .
|
13 |
|
14 |
+
# Install Python dependencies
|
15 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
16 |
+
pip install --no-cache-dir -r requirements.txt && \
|
17 |
+
pip install --no-cache-dir libsql-experimental==0.0.49 libsql-client==0.2.0
|
18 |
|
19 |
+
# Copy the rest of the application
|
20 |
COPY . .
|
21 |
|
22 |
+
# Set environment variables
|
23 |
+
ENV PORT=7860
|
24 |
+
|
25 |
+
# Print installed packages for debugging
|
26 |
+
RUN pip list | grep libsql
|
27 |
+
|
28 |
+
# Use the PORT environment variable in the CMD
|
29 |
+
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port $PORT"]
|
main.py
CHANGED
@@ -467,6 +467,7 @@ async def root():
|
|
467 |
Returns:
|
468 |
dict: Basic information about the API and links to documentation.
|
469 |
"""
|
|
|
470 |
return {
|
471 |
"message": "Welcome to Seamo Auth Server API",
|
472 |
"version": "1.0.0",
|
@@ -492,6 +493,7 @@ async def health_check():
|
|
492 |
Returns:
|
493 |
dict: Status information about the server.
|
494 |
"""
|
|
|
495 |
return {
|
496 |
"status": "healthy",
|
497 |
"version": "1.0.0",
|
@@ -507,4 +509,6 @@ app.include_router(projects_router.router, prefix="/api/projects", tags=["Projec
|
|
507 |
app.include_router(journals_router.router, prefix="/api/journals", tags=["Journals"])
|
508 |
|
509 |
if __name__ == "__main__":
|
510 |
-
|
|
|
|
|
|
467 |
Returns:
|
468 |
dict: Basic information about the API and links to documentation.
|
469 |
"""
|
470 |
+
logger.info("Root endpoint accessed")
|
471 |
return {
|
472 |
"message": "Welcome to Seamo Auth Server API",
|
473 |
"version": "1.0.0",
|
|
|
493 |
Returns:
|
494 |
dict: Status information about the server.
|
495 |
"""
|
496 |
+
logger.info("Health check endpoint accessed")
|
497 |
return {
|
498 |
"status": "healthy",
|
499 |
"version": "1.0.0",
|
|
|
509 |
app.include_router(journals_router.router, prefix="/api/journals", tags=["Journals"])
|
510 |
|
511 |
if __name__ == "__main__":
|
512 |
+
port = int(os.getenv("PORT", 7860))
|
513 |
+
logger.info(f"Starting server on port {port}")
|
514 |
+
uvicorn.run("main:app", host="0.0.0.0", port=port)
|