-
Notifications
You must be signed in to change notification settings - Fork 1
/
CeleryDockerFile
44 lines (29 loc) · 1.15 KB
/
CeleryDockerFile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Dockerfile.celery
# Stage 1: Install dependencies
FROM python:3.11 as requirements-stage
WORKDIR /tmp
# Install Poetry
RUN pip install poetry
# Copy the dependency files
COPY ./pyproject.toml ./poetry.lock* /tmp/
# Export dependencies to requirements.txt
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# Stage 2: Build the Celery worker image
FROM python:3.11
WORKDIR /code
# Install supervisord
RUN apt-get update && apt-get install -y supervisor
# Copy the exported requirements
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the application code
COPY ./suantrazabilidadapi /code/suantrazabilidadapi
# Set the working directory
# WORKDIR /code/suantrazabilidadapi
# Run the Celery worker
# CMD ["celery", "-A", "suantrazabilidadapi.app.celery_app", "worker", "--loglevel=debug"]
# Copy supervisord config
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Run supervisord to manage Celery worker and Celery Beat
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]