update with latest build versions, includes custom build for postgres and migrating from v16 to v18

This commit is contained in:
2026-01-14 22:33:45 +02:00
parent 8ff8126d41
commit 9f7fa24931
27 changed files with 1371 additions and 309 deletions

View File

@@ -3,18 +3,21 @@
FROM bookwyrm-base AS bookwyrm-worker
LABEL org.opencontainers.image.title="BookWyrm Worker" \
org.opencontainers.image.description="BookWyrm Celery background task processor"
# 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 autoremove -y \
&& apt-get clean \
&& apt-get autoremove -y
&& rm -rf /var/lib/apt/lists/*
# Install Celery in virtual environment
RUN /opt/venv/bin/pip install --no-cache-dir celery[redis]
# 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'
# Copy worker-specific configuration
COPY supervisord-worker.conf /etc/supervisor/conf.d/supervisord.conf
@@ -22,16 +25,11 @@ 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"]