diff --git a/app/backend/Dockerfile.prod b/app/backend/Dockerfile.prod index 2a63aba..02e4bb8 100644 --- a/app/backend/Dockerfile.prod +++ b/app/backend/Dockerfile.prod @@ -68,7 +68,7 @@ COPY --from=builder /usr/src/app/wheels /wheels COPY --from=builder /usr/src/app/Pipfile . RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple RUN pip install --no-cache /wheels/* -RUN pipenv install --deploy +RUN pipenv install --deploy --ignore-pipfile --dev RUN pipenv run pip install "uvicorn[standard]==0.26.0" # add app diff --git a/app/docker-compose.yml b/app/docker-compose.yml index ede7a8b..4b934ff 100644 --- a/app/docker-compose.yml +++ b/app/docker-compose.yml @@ -13,6 +13,7 @@ services: build: context: ./backend dockerfile: Dockerfile + container_name: backend platform: linux/amd64 command: pipenv run uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000 volumes: diff --git a/app/frontend/.dockerignore b/app/frontend/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/app/frontend/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json index 306491e..0d36139 100644 --- a/app/frontend/package-lock.json +++ b/app/frontend/package-lock.json @@ -16,6 +16,7 @@ "@eslint/js": "^9.21.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", + "@types/node": "^22.14.0", "@types/react": "^19.0.10", "@types/react-dom": "^19.0.4", "@vitejs/plugin-react": "^4.3.4", @@ -1711,6 +1712,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.14.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.0.tgz", + "integrity": "sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, "node_modules/@types/react": { "version": "19.1.0", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz", @@ -5228,6 +5239,13 @@ "typescript": ">=4.8.4 <5.9.0" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", diff --git a/app/frontend/package.json b/app/frontend/package.json index cf72ed2..65af888 100644 --- a/app/frontend/package.json +++ b/app/frontend/package.json @@ -20,6 +20,7 @@ "@eslint/js": "^9.21.0", "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.3.0", + "@types/node": "^22.14.0", "@types/react": "^19.0.10", "@types/react-dom": "^19.0.4", "@vitejs/plugin-react": "^4.3.4", @@ -36,4 +37,4 @@ "vite": "^6.2.0", "vitest": "^3.1.1" } -} \ No newline at end of file +} diff --git a/app/frontend/src/App.tsx b/app/frontend/src/App.tsx index f6dbf71..6f390b9 100644 --- a/app/frontend/src/App.tsx +++ b/app/frontend/src/App.tsx @@ -1,5 +1,8 @@ import React, { useState, useEffect, useRef } from 'react'; +const BASE_DOMAIN_NAME = process.env.REACT_APP_DOMAIN_NAME || 'localhost'; + + interface Message { sender: 'user' | 'bot'; text: string; @@ -13,7 +16,7 @@ const App: React.FC = () => { useEffect(() => { mounted.current = true; - const ws = new WebSocket('ws://localhost:8004/ws'); + const ws = new WebSocket(`ws://${BASE_DOMAIN_NAME}:8004/ws`); setSocket(ws); ws.onopen = () => { console.log('WebSocket connection opened'); diff --git a/app/frontend/vite.config.ts b/app/frontend/vite.config.ts index 399a019..d767938 100644 --- a/app/frontend/vite.config.ts +++ b/app/frontend/vite.config.ts @@ -4,9 +4,11 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], - test: { - globals: true, - environment: "jsdom", - setupFiles: "./tests/setup.ts", - }, }); + +// https://vitest.dev/config/ +export const test = { + globals: true, + environment: "jsdom", + setupFiles: "./tests/setup.ts", +};