40 lines
830 B
Docker
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 \
|
|
MESHBOT_CONFIG=/etc/meshbot/config.toml \
|
|
MESHBOT_STORAGE__SQLITE_PATH=/data/meshbot.db
|
|
|
|
RUN useradd --system --home /app --shell /usr/sbin/nologin meshbot \
|
|
&& mkdir -p /data /etc/meshbot \
|
|
&& chown meshbot:meshbot /data
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /wheels/*.whl /tmp/wheels/
|
|
RUN pip install --no-cache-dir /tmp/wheels/*.whl \
|
|
&& rm -rf /tmp/wheels
|
|
|
|
USER meshbot
|
|
|
|
VOLUME ["/data", "/etc/meshbot"]
|
|
|
|
ENTRYPOINT ["meshbot"]
|