cleanup + unified worker
This commit is contained in:
33
unified-worker/Dockerfile
Normal file
33
unified-worker/Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
LABEL maintainer="andreas@knuth.dev"
|
||||
LABEL description="Unified multi-domain email worker"
|
||||
|
||||
# System packages
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Non-root user
|
||||
RUN useradd -m -u 1000 worker && \
|
||||
mkdir -p /app /var/log/email-worker /etc/email-worker && \
|
||||
chown -R worker:worker /app /var/log/email-worker /etc/email-worker
|
||||
|
||||
# Python dependencies
|
||||
COPY requirements.txt /app/
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
# Worker code
|
||||
COPY --chown=worker:worker unified_worker.py /app/
|
||||
|
||||
WORKDIR /app
|
||||
USER worker
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/health || exit 1
|
||||
|
||||
# Unbuffered output
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
CMD ["python", "unified_worker.py"]
|
||||
Reference in New Issue
Block a user