diff --git a/.gitignore b/.gitignore index ad3f523..3ec0b26 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ Thumbs.db vite.config.*.timestamp* vitest.config.*.timestamp* -.env \ No newline at end of file +.env +static \ No newline at end of file diff --git a/compose/dev/docker-compose.yml b/compose/dev/docker-compose.yml new file mode 100644 index 0000000..e29d678 --- /dev/null +++ b/compose/dev/docker-compose.yml @@ -0,0 +1,28 @@ + +services: + + web: + build: + context: ../.. + dockerfile: compose/dev/node/Dockerfile + environment: + NODE_ENV: development + ports: + - "0.0.0.0:5173:5173" + volumes: + - ../../src:/app/src + - ../../index.html:/app/index.html + - ../../vite.config.ts:/app/vite.config.ts + - ../../tsconfig.json:/app/tsconfig.json + + api: + build: + context: ../.. + dockerfile: compose/dev/python/Dockerfile + ports: + - "0.0.0.0:8000:8000" + volumes: + - ../../:/app:cached + - ../../build:/app/build + + diff --git a/compose/dev/node/Dockerfile b/compose/dev/node/Dockerfile new file mode 100644 index 0000000..d40fc0a --- /dev/null +++ b/compose/dev/node/Dockerfile @@ -0,0 +1,13 @@ +FROM node:22-bullseye + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm install + +COPY src ./src +COPY index.html . +COPY vite.config.* . +COPY tsconfig.* . + +CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"] \ No newline at end of file diff --git a/compose/dev/python/Dockerfile b/compose/dev/python/Dockerfile new file mode 100644 index 0000000..c8e0b3c --- /dev/null +++ b/compose/dev/python/Dockerfile @@ -0,0 +1,39 @@ +FROM node:22-alpine AS node + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY src ./src +COPY index.html . +COPY vite.config.* . +COPY tsconfig.* . + +RUN npm run build + +FROM python:3.14.0-bookworm as python + +RUN apt-get update && apt-get install --no-install-recommends -y \ + build-essential \ + libpq-dev \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --no-cache-dir --requirement /requirements.txt + +WORKDIR /app + +RUN apt-get update && apt-get install --no-install-recommends -y \ + sudo git bash-completion nano ssh + +COPY . . + +COPY --from=node /app/build ./build + +COPY ./compose/prod/start /start +RUN sed -i 's/\r$//g' /start +RUN chmod +x /start + +ENTRYPOINT ["/start"] \ No newline at end of file diff --git a/compose/prod/Dockerfile b/compose/prod/Dockerfile index 22a9692..fc7021c 100644 --- a/compose/prod/Dockerfile +++ b/compose/prod/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22-alpine AS builder +FROM node:22-alpine AS node WORKDIR /app @@ -11,21 +11,33 @@ RUN npm ci COPY . . -RUN npm run build:api -RUN npm run build:web +RUN npm run build -FROM node:22-alpine +FROM python:3.14.0-bookworm as python + +RUN apt-get update && apt-get install --no-install-recommends -y \ + build-essential \ + libpq-dev \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --no-cache-dir --requirement /requirements.txt WORKDIR /app +RUN apt-get update && apt-get install --no-install-recommends -y \ + sudo git bash-completion nano ssh + +COPY . . + COPY package*.json ./ RUN npm ci --omit=dev -COPY --from=builder /app/dist/apps/api ./dist/api -COPY --from=builder /app/dist/apps/web ./dist/web +COPY --from=node /app/build ./build -COPY ./apps/api/src ./apps/api/src +COPY ./compose/prod/start /start +RUN sed -i 's/\r$//g' /start +RUN chmod +x /start -EXPOSE 3000 - -CMD ["node", "dist/api/main.js"] +ENTRYPOINT ["/start"] \ No newline at end of file diff --git a/compose/prod/start b/compose/prod/start new file mode 100644 index 0000000..24964c4 --- /dev/null +++ b/compose/prod/start @@ -0,0 +1,8 @@ +#!/bin/bash + +set -o errexit +set -o pipefail +set -o nounset + +python manage.py collectstatic --noinput +exec /usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:8000 diff --git a/config/__pycache__/__init__.cpython-314.pyc b/config/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..a52b62f Binary files /dev/null and b/config/__pycache__/__init__.cpython-314.pyc differ diff --git a/config/__pycache__/settings.cpython-314.pyc b/config/__pycache__/settings.cpython-314.pyc new file mode 100644 index 0000000..908a4b2 Binary files /dev/null and b/config/__pycache__/settings.cpython-314.pyc differ diff --git a/config/__pycache__/urls.cpython-314.pyc b/config/__pycache__/urls.cpython-314.pyc new file mode 100644 index 0000000..6ca4391 Binary files /dev/null and b/config/__pycache__/urls.cpython-314.pyc differ diff --git a/config/__pycache__/wsgi.cpython-314.pyc b/config/__pycache__/wsgi.cpython-314.pyc new file mode 100644 index 0000000..ec4a766 Binary files /dev/null and b/config/__pycache__/wsgi.cpython-314.pyc differ diff --git a/config/settings.py b/config/settings.py index babf03a..ca38e20 100644 --- a/config/settings.py +++ b/config/settings.py @@ -115,6 +115,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/5.2/howto/static-files/ STATIC_URL = 'static/' +STATIC_ROOT = 'static/' # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/eslint.config.mjs b/eslint.config.mjs index b3573c7..154061a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,6 +9,7 @@ export default [ { ignores: [ '**/dist', + '**/build', '**/vite.config.*.timestamp*', '**/vitest.config.*.timestamp*' ] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f16127e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,113 @@ +aiohappyeyeballs==2.6.1 +aiohttp==3.13.2 +aiosignal==1.4.0 +annotated-types==0.7.0 +anyio==4.11.0 +asgiref==3.10.0 +asttokens==3.0.0 +attrs==25.4.0 +beautifulsoup4==4.14.2 +brotli==1.2.0 +cachetools==6.2.1 +certifi==2025.10.5 +charset-normalizer==3.4.4 +click==8.3.0 +colorama==0.4.6 +comm==0.2.3 +dataclasses-json==0.6.7 +ddgs==9.9.0 +debugpy==1.8.17 +decorator==5.2.1 +Django==5.2.8 +duckduckgo_search==8.1.1 +executing==2.2.1 +filetype==1.2.0 +frozenlist==1.8.0 +google-ai-generativelanguage==0.9.0 +google-api-core==2.28.1 +google-auth==2.43.0 +googleapis-common-protos==1.72.0 +greenlet==3.2.4 +grpcio==1.76.0 +grpcio-status==1.76.0 +gunicorn==23.0.0 +h11==0.16.0 +h2==4.3.0 +hpack==4.1.0 +httpcore==1.0.9 +httpx==0.28.1 +httpx-sse==0.4.3 +hyperframe==6.1.0 +idna==3.11 +ipykernel==7.1.0 +ipython==9.7.0 +ipython_pygments_lexers==1.1.1 +jedi==0.19.2 +jsonpatch==1.33 +jsonpointer==3.0.0 +jupyter_client==8.6.3 +jupyter_core==5.9.1 +langchain==1.0.5 +langchain-classic==1.0.0 +langchain-community==0.4.1 +langchain-core==1.0.4 +langchain-google-genai==3.0.1 +langchain-text-splitters==1.0.0 +langgraph==1.0.3 +langgraph-checkpoint==3.0.1 +langgraph-prebuilt==1.0.2 +langgraph-sdk==0.2.9 +langsmith==0.4.42 +lxml==6.0.2 +marshmallow==3.26.1 +matplotlib-inline==0.2.1 +multidict==6.7.0 +mypy_extensions==1.1.0 +nest-asyncio==1.6.0 +numpy==2.3.4 +orjson==3.11.4 +ormsgpack==1.12.0 +packaging==25.0 +parso==0.8.5 +pip3-autoremove==2.0.1 +platformdirs==4.5.0 +primp==0.15.0 +prompt_toolkit==3.0.52 +propcache==0.4.1 +proto-plus==1.26.1 +protobuf==6.33.0 +psutil==7.1.3 +pure_eval==0.2.3 +pyasn1==0.6.1 +pyasn1_modules==0.4.2 +pydantic==2.12.4 +pydantic-settings==2.11.0 +pydantic_core==2.41.5 +Pygments==2.19.2 +python-dateutil==2.9.0.post0 +python-dotenv==1.2.1 +PyYAML==6.0.3 +pyzmq==27.1.0 +requests==2.32.5 +requests-toolbelt==1.0.0 +rsa==4.9.1 +six==1.17.0 +sniffio==1.3.1 +socksio==1.0.0 +soupsieve==2.8 +SQLAlchemy==2.0.44 +sqlmodel==0.0.27 +sqlparse==0.5.3 +stack-data==0.6.3 +tenacity==9.1.2 +tornado==6.5.2 +traitlets==5.14.3 +typing-inspect==0.9.0 +typing-inspection==0.4.2 +typing_extensions==4.15.0 +tzdata==2025.2 +urllib3==2.5.0 +wcwidth==0.2.14 +xxhash==3.6.0 +yarl==1.22.0 +zstandard==0.25.0 diff --git a/tsconfig.json b/tsconfig.json index 8d79c7a..e2db6ac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,7 +22,7 @@ "types": ["vite/client"], "baseUrl": ".", "paths": {}, - "outDir": "../../dist/out-tsc", + "outDir": "./build/out-tsc", "lib": ["es2020", "dom"] }, "include": [ diff --git a/vite.config.ts b/vite.config.ts index c6fee47..3ce794e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: './node_modules/.vite/build', server: { - port: 4200, + port: 5173, host: 'localhost', }, preview: {