force rewrited code
This commit is contained in:
22
backend/app/Dockerfile
Normal file
22
backend/app/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install uv package manager
|
||||
RUN pip install uv
|
||||
|
||||
# Copy project configuration
|
||||
COPY pyproject.toml .
|
||||
# Copy uv.lock if it exists, otherwise just the pyproject (using wildcard)
|
||||
COPY uv.lock* ./
|
||||
|
||||
# Install dependencies using uv
|
||||
RUN uv sync
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the FastAPI server
|
||||
CMD ["uv", "run", "python", "main.py"]
|
||||
@@ -1,3 +1,5 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
@@ -5,10 +7,19 @@ from src.config import ALLOWED_ORIGINS
|
||||
from src.database import init_db
|
||||
from src.routers import init, login, status
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Initialize database on startup."""
|
||||
init_db()
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="Archivium Local Backend",
|
||||
description="Local archive encryption and authentication system",
|
||||
version="0.1.0",
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
app.add_middleware(
|
||||
@@ -23,13 +34,6 @@ app.include_router(init.router)
|
||||
app.include_router(login.router)
|
||||
app.include_router(status.router)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
def startup():
|
||||
"""Initialize database on startup."""
|
||||
init_db()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run(app, host="127.0.0.1", port=8000)
|
||||
|
||||
6
backend/app/package-lock.json
generated
Normal file
6
backend/app/package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
1191
backend/app/uv.lock
generated
Normal file
1191
backend/app/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user