Set to run on tagged, with celery and redis services

This commit is contained in:
Viswamedha Nalabotu 2025-12-20 23:29:11 +00:00
parent 5d9a486eb7
commit 6dffa377f1
4 changed files with 54 additions and 2 deletions

View file

@ -32,8 +32,9 @@ build_and_push:
- echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY_URL"
- export IMAGE_NAME="${REGISTRY_URL}/${IMAGE_PATH}:${IMAGE_TAG}"
- echo "Building image ${IMAGE_NAME}"
- docker build -t "$IMAGE_NAME" -f ./compose/prod/Dockerfile --no-cache .
- docker build -t "$IMAGE_NAME" -f ./compose/prod/python/Dockerfile --no-cache .
- echo "Pushing image ${IMAGE_NAME}"
- docker push "$IMAGE_NAME"
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_TAG
when: always

View file

@ -0,0 +1,26 @@
FROM python:3.12.0-slim
LABEL org.opencontainers.image.title="Dynavera Celery Worker"
LABEL org.opencontainers.image.source="https://git.cs.bham.ac.uk/projects-2025-26/vxn217"
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements/* .
RUN pip install --no-cache-dir -r prod.txt
COPY manage.py manage.py
COPY config config
COPY apps apps
COPY data data
RUN mkdir -p /app/static
CMD ["celery", "-A", "config.celery", "worker", "--loglevel=info"]

View file

@ -38,6 +38,31 @@ services:
networks:
- proxy
fyp-redis:
image: redis:7-alpine
container_name: fyp-redis
restart: unless-stopped
networks:
- proxy
fyp-celery:
build:
context: ./
dockerfile: compose/prod/celery/Dockerfile
image: ${CELERY_IMAGE:-fyp-celery:latest}
container_name: fyp-celery
restart: unless-stopped
env_file:
- ../../.env
depends_on:
- fyp-redis
- fyp-postgres
networks:
- proxy
volumes:
- ../../static:/app/static
- ../../media:/app/media
fyp-watchtower:
image: containrrr/watchtower
command: