65 lines
1.8 KiB
Docker
65 lines
1.8 KiB
Docker
# Build the local GPU image with: docker build --target local -t kandrusyak-bot:local .
|
|
FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04 AS local
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
ASSISTANT_MODE=local \
|
|
ASSISTANT_DB=/data/assistant_data.sqlite3 \
|
|
HF_HOME=/data/huggingface
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install --no-install-recommends --yes python3 python3-pip tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements-common.txt requirements-local.txt ./
|
|
RUN python3 -m pip install --no-cache-dir --requirement requirements-local.txt
|
|
|
|
RUN groupadd --system bot \
|
|
&& useradd --system --gid bot --create-home bot \
|
|
&& mkdir /data \
|
|
&& chown bot:bot /data
|
|
|
|
COPY --chown=bot:bot assistant_bot ./assistant_bot
|
|
COPY --chown=bot:bot main.py ./main.py
|
|
|
|
USER bot
|
|
VOLUME ["/data"]
|
|
STOPSIGNAL SIGTERM
|
|
CMD ["python3", "-m", "assistant_bot"]
|
|
|
|
|
|
# Build the cloud image with: docker build --target yandex -t kandrusyak-bot:yandex .
|
|
# This is the default final target when --target is omitted.
|
|
FROM python:3.12.13-slim-bookworm AS yandex
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
ASSISTANT_MODE=yandex \
|
|
ASSISTANT_DB=/data/assistant_data.sqlite3
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install --no-install-recommends --yes tzdata \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements-common.txt requirements-yandex.txt ./
|
|
RUN python -m pip install --no-cache-dir --requirement requirements-yandex.txt
|
|
|
|
RUN groupadd --system bot \
|
|
&& useradd --system --gid bot --create-home bot \
|
|
&& mkdir /data \
|
|
&& chown bot:bot /data
|
|
|
|
COPY --chown=bot:bot assistant_bot ./assistant_bot
|
|
COPY --chown=bot:bot main.py ./main.py
|
|
|
|
USER bot
|
|
VOLUME ["/data"]
|
|
STOPSIGNAL SIGTERM
|
|
CMD ["python", "-m", "assistant_bot"]
|