telebot_template/Dockerfile
2024-07-21 04:46:50 +03:00

38 lines
746 B
Docker

ARG PYTHON_VERSION=3.10
FROM python:${PYTHON_VERSION}-slim
# avoid .pyc and buffering stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# add non-root user
ARG UID=1000
RUN adduser \
--disabled-password \
--no-create-home \
--uid "${UID}" \
--home "/app" \
bot
# install requirements
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
pip install -r requirements.txt
# copy i18n files
COPY --chown=bot i18n.yaml i18n/i18n.yaml
VOLUME i18n/
# copy default configs
WORKDIR /app
COPY --chown=bot mybot mybot
# preapre environment
ENV SS_TYPE=memory
ENV I18N_PATH=/i18n/i18n.yaml
# set user
USER bot
CMD ["python3", "-m", "mybot"]