Added polling and auto rebuild with requirements

This commit is contained in:
Viswamedha Nalabotu 2025-12-10 14:37:06 +00:00
parent b1ecd01507
commit 1042ee5d22
6 changed files with 38 additions and 46 deletions

View file

@ -6,13 +6,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
ENV VIRTUAL_ENV=/venv \
PATH=/venv/bin:$PATH
RUN python -m venv /venv
WORKDIR /app
COPY requirements/* /tmp/requirements/
RUN pip install --no-cache-dir --requirement /tmp/requirements/local.txt
COPY manage.py manage.py
COPY config config
COPY apps apps
COPY requirements/base.txt .
RUN pip install --no-cache-dir --requirement base.txt
CMD ["celery", "-A", "config", "worker", "-l", "info"]

View file

@ -20,13 +20,17 @@ services:
dockerfile: compose/dev/node/Dockerfile
environment:
NODE_ENV: development
CHOKIDAR_USEPOLLING: "true"
stdin_open: true
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
- ../../src:/app/src:delegated
- ../../index.html:/app/index.html:delegated
- ../../vite.config.ts:/app/vite.config.ts:delegated
- ../../tsconfig.json:/app/tsconfig.json:delegated
- ../../build:/app/build:delegated
- /app/node_modules
api:
build:
@ -35,25 +39,27 @@ services:
ports:
- "0.0.0.0:8000:8000"
volumes:
- ../../:/app:cached
- ../../build:/app/build
- ../../:/app
- venv:/venv
environment:
DJANGO_CELERY_BROKER_URL: redis://fyp-redis:6379/0
CELERY_BROKER_URL: redis://fyp-redis:6379/0
DJANGO_SETTINGS_MODULE: config.settings
depends_on:
fyp-redis:
condition: service_healthy
web:
condition: service_started
celery:
build:
context: ../..
dockerfile: compose/dev/celery/Dockerfile
command: celery -A config worker -l info
volumes:
- ../../:/app:cached
- ../../:/app
- venv:/venv
- ${USERPROFILE}/.cache/gpt4all:/root/.cache/gpt4all:ro
environment:
DJANGO_CELERY_BROKER_URL: redis://fyp-redis:6379/0
CELERY_BROKER_URL: redis://fyp-redis:6379/0
DJANGO_SETTINGS_MODULE: config.settings
depends_on:
fyp-redis:
@ -61,3 +67,4 @@ services:
volumes:
redis_data:
venv:

View file

@ -3,11 +3,13 @@ FROM node:22-bullseye
WORKDIR /app
COPY package*.json ./
RUN npm ci
RUN npm ci && npm cache clean --force
COPY src ./src
COPY index.html .
COPY vite.config.* .
COPY tsconfig.* .
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
EXPOSE 5173
CMD ["sh", "-c", "npm run dev -- --host 0.0.0.0 & npm run build -- --watch"]

View file

@ -1,18 +1,4 @@
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.12-bookworm as python
FROM python:3.12-bookworm
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
@ -20,19 +6,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
COPY requirements/* .
RUN pip install --no-cache-dir --requirement local.txt
ENV VIRTUAL_ENV=/venv \
PATH=/venv/bin:$PATH
RUN python -m venv /venv
WORKDIR /app
COPY manage.py manage.py
COPY config config
COPY apps apps
COPY requirements/base.txt .
RUN pip install --no-cache-dir --requirement base.txt
COPY --from=node /app/build ./build
COPY ./compose/prod/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
ENTRYPOINT ["/start"]
CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "config.asgi:application"]

View file

@ -14,7 +14,7 @@ COPY index.html .
RUN npm run build
FROM python:3.14.0-slim as python
FROM python:3.12.0-slim AS python
LABEL org.opencontainers.image.title="Dynavera - An Agentic Approach to Domain-Specific Trainers"
LABEL org.opencontainers.image.source="https://git.cs.bham.ac.uk/projects-2025-26/vxn217"

View file

@ -1,6 +1,7 @@
asgiref==3.10.0
celery==5.6.0
django==5.2.8
django-cors-headers==4.3.1
djangorestframework==3.16.1
channels[daphne]==4.3.0
channels-redis==4.1.0