add source code and readme

This commit is contained in:
2025-12-24 14:35:17 +01:00
parent 7c92e1e610
commit 74324d5a1b
331 changed files with 39272 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
# BookWyrm Worker Container - Production Optimized
# Celery background task processor
FROM bookwyrm-base AS bookwyrm-worker
# 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 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& apt-get autoremove -y
# Install Celery in virtual environment
RUN /opt/venv/bin/pip install --no-cache-dir celery[redis]
# 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 \
&& mkdir -p /var/log/supervisor /var/log/celery \
&& chown -R bookwyrm:bookwyrm /var/log/celery \
&& 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
# Run as root to manage celery via supervisor
USER root
ENTRYPOINT ["/entrypoint.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]