From 308fdee908d7d5fd594a908bee1a78af6fc9fcaa Mon Sep 17 00:00:00 2001 From: Perny Date: Mon, 27 Oct 2025 02:14:49 +0200 Subject: [PATCH] add python tail --- tails/python.tail.dockerfile | 29 +++++++++++++++++++++++++++++ tails/python.tail.toml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 tails/python.tail.dockerfile create mode 100644 tails/python.tail.toml diff --git a/tails/python.tail.dockerfile b/tails/python.tail.dockerfile new file mode 100644 index 0000000..40de7e6 --- /dev/null +++ b/tails/python.tail.dockerfile @@ -0,0 +1,29 @@ +ARG PYTHON_VERSION=3.14 +FROM python:${PYTHON_VERSION}-alpine +COPY repo /bot +WORKDIR /bot + +ARG MAIN_FILE=main.py +ENV MAIN_FILE=${MAIN_FILE} + +ARG REQUIREMENTS_FILE=requirements.txt +ENV REQUIREMENTS_FILE=${REQUIREMENTS_FILE} + +ARG VENV_ENABLED=false +ENV VENV_ENABLED=${VENV_ENABLED} + +RUN if [ -f "${REQUIREMENTS_FILE}" ]; then \ + if [ "$VENV_ENABLED" = "true" ]; then \ + python -m venv /opt/venv; \ + . /opt/venv/bin/activate; \ + pip install --no-cache-dir -r "${REQUIREMENTS_FILE}"; \ + else \ + pip install --no-cache-dir -r "${REQUIREMENTS_FILE}"; \ + fi \ + fi + +CMD if [ "$VENV_ENABLED" = "true" ]; then \ + . /opt/venv/bin/activate && python ${MAIN_FILE}; \ + else \ + python ${MAIN_FILE}; \ + fi diff --git a/tails/python.tail.toml b/tails/python.tail.toml new file mode 100644 index 0000000..1ad3807 --- /dev/null +++ b/tails/python.tail.toml @@ -0,0 +1,30 @@ +[tail] +name = "python" +display_name = "Python" +description = "Python Discord bot with pip support" +last_modified = 2025-10-27 + +[config.main_file] +type = "string" +default = "main.py" +arg = "MAIN_FILE" +description = "The main Python file to run when starting your bot." + +[config.python_version] +type = "string" +default = "3.14" +arg = "PYTHON_VERSION" +description = "Version of Python to use." + +[config.requirements_file] +type = "string" +default = "requirements.txt" +arg = "REQUIREMENTS_FILE" +description = "Path to requirements.txt file for dependencies." + +[config.venv_enabled] +type = "string" +default = "false" +arg = "VENV_ENABLED" +description = "Whether to use Python virtual environment." +options = ["true", "false"]