Added worker tasks to docker-compose
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
FROM python:3.11-slim as builder
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements/base.txt requirements/base.txt
|
||||
COPY requirements/production.txt requirements/production.txt
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade pip wheel && \
|
||||
pip install --no-cache-dir -r requirements/production.txt
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libpq5 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN groupadd --gid 1000 appgroup && \
|
||||
useradd --uid 1000 --gid appgroup --shell /bin/bash --create-home appuser
|
||||
|
||||
COPY --from=builder /opt/venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
WORKDIR /app
|
||||
COPY --chown=appuser:appgroup . .
|
||||
|
||||
RUN mkdir -p /app/logs && chown -R appuser:appgroup /app/logs
|
||||
|
||||
USER appuser
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD pgrep -f "job_runner" || exit 1
|
||||
|
||||
CMD ["python", "scripts/job_runner.py"]
|
||||
Reference in New Issue
Block a user