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

View file

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

View file

@ -3,11 +3,13 @@ FROM node:22-bullseye
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci && npm cache clean --force
COPY src ./src COPY src ./src
COPY index.html . COPY index.html .
COPY vite.config.* . COPY vite.config.* .
COPY tsconfig.* . 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 FROM python:3.12-bookworm
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
RUN apt-get update && apt-get install --no-install-recommends -y \ RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \ 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 \ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY requirements/* . ENV VIRTUAL_ENV=/venv \
RUN pip install --no-cache-dir --requirement local.txt PATH=/venv/bin:$PATH
RUN python -m venv /venv
WORKDIR /app WORKDIR /app
COPY manage.py manage.py COPY requirements/base.txt .
COPY config config RUN pip install --no-cache-dir --requirement base.txt
COPY apps apps
COPY --from=node /app/build ./build CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "config.asgi:application"]
COPY ./compose/prod/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
ENTRYPOINT ["/start"]

View file

@ -14,7 +14,7 @@ COPY index.html .
RUN npm run build 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.title="Dynavera - An Agentic Approach to Domain-Specific Trainers"
LABEL org.opencontainers.image.source="https://git.cs.bham.ac.uk/projects-2025-26/vxn217" 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 asgiref==3.10.0
celery==5.6.0 celery==5.6.0
django==5.2.8 django==5.2.8
django-cors-headers==4.3.1
djangorestframework==3.16.1 djangorestframework==3.16.1
channels[daphne]==4.3.0 channels[daphne]==4.3.0
channels-redis==4.1.0 channels-redis==4.1.0