|
|
|
ARG ARCH="x86_64" |
|
ARG HOME="/home/python" |
|
ARG FASTAPI_STATIC="${HOME}/static" |
|
ARG PYTHONPATH="${HOME}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages" |
|
ARG POETRY_NO_INTERACTION=1 |
|
ARG POETRY_VIRTUALENVS_IN_PROJECT=1 |
|
ARG POETRY_VIRTUALENVS_CREATE=1 |
|
ARG POETRY_CACHE_DIR=/tmp/poetry_cache |
|
ARG HOME=/home/python |
|
|
|
FROM python:3.13-bookworm AS builder_global |
|
LABEL authors="trincadev" |
|
|
|
ARG ARCH |
|
ARG PYTHONPATH |
|
ARG POETRY_NO_INTERACTION |
|
ARG POETRY_VIRTUALENVS_IN_PROJECT |
|
ARG POETRY_VIRTUALENVS_CREATE |
|
ARG POETRY_CACHE_DIR |
|
ARG HOME |
|
|
|
RUN echo "ARCH: $ARCH ..." |
|
RUN echo "HOME: ${HOME} ..." |
|
RUN echo "PYTHONPATH: ${PYTHONPATH} ..." |
|
RUN echo "===========================" |
|
|
|
RUN echo "ARG POETRY_CACHE_DIR: ${POETRY_CACHE_DIR} ..." |
|
RUN echo "ARG PYTHONPATH: $PYTHONPATH ..." |
|
RUN echo "arg dep:" |
|
|
|
RUN groupadd -g 999 python && useradd -r -u 999 -g python python |
|
RUN mkdir -p ${HOME} ${HOME}/.config && chown python:python -R ${HOME} |
|
RUN ls -ld ${HOME} |
|
RUN ls -l ${HOME} |
|
WORKDIR ${HOME} |
|
|
|
COPY --chown=python:python requirements_poetry.txt pyproject.toml poetry.lock README.md ${HOME}/ |
|
|
|
|
|
RUN python -m pip install -r ${HOME}/requirements_poetry.txt |
|
|
|
RUN which poetry && poetry --version && poetry config --list |
|
RUN poetry config virtualenvs.path ${HOME} |
|
RUN echo "# poetry config --list #" && poetry config --list |
|
RUN poetry install --with webserver --no-cache |
|
|
|
FROM python:3.13-slim-bookworm AS runtime |
|
|
|
ARG ARCH |
|
ARG HOME |
|
|
|
ENV VIRTUAL_ENV=${HOME}/.venv PATH="${HOME}/.venv/bin:$PATH" |
|
|
|
|
|
RUN mkdir -p /home |
|
RUN groupadd -g 999 python && useradd -r -u 999 -g python python |
|
RUN ls -l /home |
|
RUN ls -ld /home |
|
RUN mkdir -p ${HOME} ${HOME}/.config && chown python:python -R ${HOME} |
|
RUN ls -ld ${HOME} |
|
RUN ls -lA ${HOME} |
|
WORKDIR ${HOME} |
|
|
|
COPY --from=builder_global ${HOME}/.venv ${HOME}/.venv |
|
RUN . ${HOME}/.venv && which python && pip list |
|
|
|
RUN mkdir -p ${HOME}/nltk_data/corpora ${HOME}/nltk_data/tokenizers/punkt_tab \ |
|
${HOME}/nltk_data/tokenizers/punkt ${HOME}/nltk_data/taggers && chown python:python -R ${HOME}/nltk_data |
|
RUN mkdir -p ${HOME}/static ${HOME}/.cache/pip && chown python:python -R ${HOME}/static ${HOME}/.cache ${HOME}/.cache/pip |
|
COPY --chown=python:python static/index-dark.css static/index.html static/index_dark.html static/index.css static/index.js ${HOME}/static/ |
|
COPY --chown=python:python lite.koboldai.net.txt my_ghost_writer.txt ${HOME}/ |
|
COPY --chown=python:python scripts/download.sh scripts/download_file.py ${HOME}/ |
|
RUN chmod +x ${HOME}/download.sh |
|
|
|
RUN echo "new HOME after hidden venv copy => ${HOME}" |
|
RUN ls -ld ${HOME}/ |
|
RUN ls -lA ${HOME}/ |
|
RUN ls -l ${HOME}/static/index.html |
|
|
|
|