diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..484cb27 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.12 + +ENV PYTHONUNBUFFERED=1 + +WORKDIR /backend + +RUN pip install poetry +RUN poetry config virtualenvs.create false + +COPY pyproject.toml* poetry.lock* ./ + +RUN poetry install --no-root --no-interaction --no-ansi + +COPY . . diff --git a/backend/core/settings.py b/backend/core/settings.py index 5a656ac..53ced92 100644 --- a/backend/core/settings.py +++ b/backend/core/settings.py @@ -90,7 +90,7 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR / "db.sqlite3", + "NAME": BASE_DIR / "db" / "db.sqlite3", } } @@ -140,7 +140,7 @@ "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", "CONFIG": { - "hosts": [("127.0.0.1", 6379)], + "hosts": [("redis", 6379)], }, }, } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f17fedd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +services: + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + volumes: + - ./frontend:/frontend + - /frontend/node_modules + command: pnpm run dev + ports: + - "5173:5173" + depends_on: + - backend + + backend: + build: + context: ./backend + dockerfile: Dockerfile + volumes: + - ./backend:/backend + - sqlite_data:/backend/db + command: daphne core.asgi:application --port 8000 --bind 0.0.0.0 + ports: + - "8000:8000" + depends_on: + - redis + + redis: + image: redis:latest + ports: + - "6379:6379" + +volumes: + sqlite_data: \ No newline at end of file diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..dd87e2d --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,2 @@ +node_modules +build diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..df02ae8 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,11 @@ +FROM node:22.12.0 + +RUN npm install -g pnpm + +WORKDIR /frontend + +COPY package.json pnpm-lock.yaml ./ + +RUN pnpm install --frozen-lockfile + +COPY . . diff --git a/frontend/src/pages/AlgorithmAndResultPage.tsx b/frontend/src/pages/AlgorithmAndResultPage.tsx index 048643d..27c02f5 100644 --- a/frontend/src/pages/AlgorithmAndResultPage.tsx +++ b/frontend/src/pages/AlgorithmAndResultPage.tsx @@ -1,9 +1,9 @@ import { useEffect, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; -// import { ConnectAlert } from "@/components/ConnectAlert"; +import { ConnectAlert } from "@/components/ConnectAlert"; import NetworkGraph from "@/components/NetworkGraph"; import SelectAlgorithm from "@/components/SelectAlgorithm"; -// import { useSharedChatHandler } from "@/hooks/WebSocketContext"; +import { useSharedChatHandler } from "@/hooks/WebSocketContext"; import { deleteResult } from "@/lib/deleteResult"; import { downloadCsv } from "@/lib/downloadCsv"; import { fetchResult } from "@/lib/fetchResult"; @@ -29,7 +29,7 @@ export default function AlgorithmAndResultPage({ payments, members }: Props) { const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const { eventId } = useParams(); - // const ws = useSharedChatHandler(); + const ws = useSharedChatHandler(); const handleSubmit = async () => { if (!algorithmId) return setError("アルゴリズムを選択してください"); @@ -75,7 +75,7 @@ export default function AlgorithmAndResultPage({ payments, members }: Props) { return (
- {/* */} + - {/* */} + - {/* */} +