40 lines
778 B
Docker
40 lines
778 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
|
|
|
|
# copy default configs
|
|
WORKDIR /app
|
|
COPY --chown=bot mybot mybot
|
|
COPY --chown=bot webapp webapp
|
|
|
|
# preapre environment
|
|
ENV SS_TYPE=memory
|
|
ENV I18N_PATH=/i18n/i18n.yaml
|
|
|
|
# set user
|
|
USER bot
|
|
|
|
CMD ["python3", "-m", "mybot"]
|
|
|
|
VOLUME i18n/
|