Files
lorabot/Dockerfile
T
2026-05-04 20:52:51 +02:00

40 lines
830 B
Docker

# syntax=docker/dockerfile:1.7
FROM python:3.12-slim AS builder
ENV PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /build
COPY pyproject.toml ./
COPY src ./src
RUN python -m pip install --upgrade pip build \
&& python -m build --wheel --outdir /wheels
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
LORABOT_CONFIG=/etc/lorabot/config.toml \
LORABOT_STORAGE__SQLITE_PATH=/data/lorabot.db
RUN useradd --system --home /app --shell /usr/sbin/nologin lorabot \
&& mkdir -p /data /etc/lorabot \
&& chown lorabot:lorabot /data
WORKDIR /app
COPY --from=builder /wheels/*.whl /tmp/wheels/
RUN pip install --no-cache-dir /tmp/wheels/*.whl \
&& rm -rf /tmp/wheels
USER lorabot
VOLUME ["/data", "/etc/lorabot"]
ENTRYPOINT ["lorabot"]