Added celery as service

This commit is contained in:
Viswamedha Nalabotu 2025-12-10 13:44:16 +00:00
parent 2dbe05782d
commit 683f6c1b98
5 changed files with 60 additions and 5 deletions

View file

@ -0,0 +1,18 @@
FROM python:3.12-bookworm
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/*
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
CMD ["celery", "-A", "config", "worker", "-l", "info"]

View file

@ -1,6 +1,19 @@
services:
fyp-redis:
image: redis:7-alpine
container_name: fyp-redis
ports:
- "0.0.0.0:6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
web:
build:
context: ../..
@ -24,5 +37,27 @@ services:
volumes:
- ../../:/app:cached
- ../../build:/app/build
environment:
DJANGO_CELERY_BROKER_URL: redis://fyp-redis:6379/0
DJANGO_SETTINGS_MODULE: config.settings
depends_on:
fyp-redis:
condition: service_healthy
celery:
build:
context: ../..
dockerfile: compose/dev/celery/Dockerfile
command: celery -A config worker -l info
volumes:
- ../../:/app:cached
- ${USERPROFILE}/.cache/gpt4all:/root/.cache/gpt4all:ro
environment:
DJANGO_CELERY_BROKER_URL: redis://fyp-redis:6379/0
DJANGO_SETTINGS_MODULE: config.settings
depends_on:
fyp-redis:
condition: service_healthy
volumes:
redis_data:

View file

@ -2,8 +2,8 @@ FROM node:22-bullseye
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY package*.json ./
RUN npm ci
COPY src ./src
COPY index.html .

View file

@ -12,7 +12,7 @@ COPY tsconfig.* .
RUN npm run build
FROM python:3.14.0-bookworm as python
FROM python:3.12-bookworm as python
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
@ -25,7 +25,9 @@ RUN pip install --no-cache-dir --requirement local.txt
WORKDIR /app
COPY . .
COPY manage.py manage.py
COPY config config
COPY apps apps
COPY --from=node /app/build ./build

View file

@ -7,4 +7,4 @@ set -o nounset
python manage.py makemigrations
python manage.py migrate
python manage.py collectstatic --noinput
exec /usr/local/bin/gunicorn config.wsgi --bind 0.0.0.0:8000
exec /usr/local/bin/daphne -b 0.0.0.0 -p 8000 config.asgi:application