Files
Keybard-Vagabond-Demo/build/bookwyrm/bookwyrm-worker/Dockerfile

35 lines
1.2 KiB
Docker
Raw Normal View History

2025-12-24 14:35:17 +01:00
# BookWyrm Worker Container - Production Optimized
# Celery background task processor
FROM bookwyrm-base AS bookwyrm-worker
LABEL org.opencontainers.image.title="BookWyrm Worker" \
org.opencontainers.image.description="BookWyrm Celery background task processor"
2025-12-24 14:35:17 +01:00
# Switch to root for system package installation
USER root
# Install only supervisor for worker management
RUN apt-get update && apt-get install -y --no-install-recommends \
supervisor \
&& apt-get autoremove -y \
2025-12-24 14:35:17 +01:00
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2025-12-24 14:35:17 +01:00
# Install Celery in virtual environment (pinned for reproducible builds)
RUN /opt/venv/bin/pip install --no-cache-dir 'celery[redis]>=5.6.0,<6.0.0'
2025-12-24 14:35:17 +01:00
# Copy worker-specific configuration
COPY supervisord-worker.conf /etc/supervisor/conf.d/supervisord.conf
COPY entrypoint-worker.sh /entrypoint.sh
# Set permissions efficiently
RUN chmod +x /entrypoint.sh \
&& chown -R bookwyrm:bookwyrm /app
# Health check for worker
HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 \
CMD /opt/venv/bin/celery -A celerywyrm inspect ping -d celery@$HOSTNAME || exit 1
ENTRYPOINT ["/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]