Skip to content

Instantly share code, notes, and snippets.

@hakjoon
Forked from jsheedy/Dockerfile
Created October 4, 2023 15:03
Show Gist options
  • Save hakjoon/ff63edee902c706bd90a72521e6fd360 to your computer and use it in GitHub Desktop.
Save hakjoon/ff63edee902c706bd90a72521e6fd360 to your computer and use it in GitHub Desktop.
dockerfile-compose for a celery worker with autoreload on code change
version: "3"
services:
redis:
image: redis:alpine
expose:
- "6379"
container_name: redis
celery-worker:
build:
dockerfile: ./docker/celery-worker/Dockerfile
context: .
environment:
- PWD
volumes:
- ${PWD}:/app
container_name: celery-worker
depends_on:
- redis
FROM python:3.6
RUN mkdir /app
ADD requirements.txt /app/
WORKDIR /app/
RUN pip install -r requirements.txt
CMD [ \
"watchmedo", \
"auto-restart", \
"--directory", "./my_project", \
"--patterns", "*.py", \
"--recursive", \
"--", \
"celery", \
"worker", \
"-A", "my_project.celery", \
"--concurrency", "1", \
"--pool", "solo", \
"--events", \
"-l", "INFO" \
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment