diff --git a/Dockerfile.api b/Dockerfile.api new file mode 100644 index 0000000..befe178 --- /dev/null +++ b/Dockerfile.api @@ -0,0 +1,17 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY src ./src +ENV KINFIN_WORKDIR=/kinfin +ENV KINFIN_PORT=8000 +ENV RESULTS_BASE_DIR=/kinfin/output +ENV SESSION_INACTIVITY_THRESHOLD=24 +ENV KINFIN_LIMIT_INIT=1/minute +ENV KINFIN_LIMIT_STANDARD=60/minute +ENV KINFIN_LIMIT_LOW=300/minute + +CMD ["python", "src/main.py", "serve", "-p", "8000"] diff --git a/Dockerfile.ui b/Dockerfile.ui new file mode 100644 index 0000000..dcb5f88 --- /dev/null +++ b/Dockerfile.ui @@ -0,0 +1,15 @@ + +FROM node:20-alpine AS build + +WORKDIR /app +COPY src/ui/package*.json ./ +RUN npm install --legacy-peer-deps +COPY src/ui/ ./ +RUN npm run build + +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1edb8ef --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +services: + api: + build: + context: . + dockerfile: Dockerfile.api + container_name: kinfin-api + volumes: + - ./data:/app/data + - /home/dinesh/tmp/kinfin:/kinfin # FIXED path + ports: + - "8000:8000" + + ui: + build: + context: . + dockerfile: Dockerfile.ui + container_name: kinfin-ui + ports: + - "5173:80" + depends_on: + - api diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..4f90f67 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html; + } +} diff --git a/src/api/__init__.py b/src/api/__init__.py index 2603a62..2793a9c 100644 --- a/src/api/__init__.py +++ b/src/api/__init__.py @@ -82,4 +82,4 @@ def hello(): app.include_router(router) - uvicorn.run(app=app, port=args.port) + uvicorn.run(app=app, host="0.0.0.0", port=args.port)