alessandro trinca tornidor
commited on
Commit
·
e71a006
1
Parent(s):
c7c291a
ci: use /home/python as WORKDIR instead of /var/task, bump to version 0.5.3, explicit exposing app_port: 7860 in README.md
Browse files- Dockerfile +12 -16
- README.md +1 -0
- dockerfiles/dockerfile_my_ghost_writer_base +32 -35
- pyproject.toml +1 -1
Dockerfile
CHANGED
|
@@ -1,22 +1,18 @@
|
|
| 1 |
-
FROM registry.gitlab.com/aletrn/my_ghost_writer_base:0.5.
|
| 2 |
|
| 3 |
LABEL authors="trincadev"
|
| 4 |
|
| 5 |
# Include global arg in this stage of the build
|
| 6 |
-
ARG
|
| 7 |
-
ENV VIRTUAL_ENV=${
|
| 8 |
ENV WRITE_TMP_ON_DISK=""
|
| 9 |
ENV MOUNT_GRADIO_APP=""
|
| 10 |
-
ENV HOME_USER=/home/python
|
| 11 |
ENV SPACY_MODEL="en_core_web_sm"
|
| 12 |
|
| 13 |
# Set working directory to function root directory
|
| 14 |
-
WORKDIR ${
|
| 15 |
-
# workaround for missing /home folder
|
| 16 |
-
RUN ls -ld ${HOME_USER}
|
| 17 |
-
RUN ls -lA ${HOME_USER}
|
| 18 |
|
| 19 |
-
# RUN . ${
|
| 20 |
RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then mkdir {WRITE_TMP_ON_DISK}; fi
|
| 21 |
RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then ls -l {WRITE_TMP_ON_DISK}; fi
|
| 22 |
|
|
@@ -25,10 +21,10 @@ RUN /usr/bin/which python
|
|
| 25 |
RUN python --version
|
| 26 |
RUN pip list
|
| 27 |
RUN echo "PATH: ${PATH}."
|
| 28 |
-
RUN echo "
|
| 29 |
-
RUN ls -l ${
|
| 30 |
-
RUN ls -ld ${
|
| 31 |
-
RUN ls -l ${
|
| 32 |
RUN python -c "import sys; print(sys.path)"
|
| 33 |
RUN python -c "import spacy"
|
| 34 |
RUN echo "python -m spacy download \"${SPACY_MODEL}\""
|
|
@@ -38,9 +34,9 @@ RUN python -c "import uvicorn"
|
|
| 38 |
RUN python -c "import pymongo"
|
| 39 |
RUN python -c "import requests"
|
| 40 |
RUN df -h
|
| 41 |
-
RUN ls -l ${
|
| 42 |
-
RUN ls -l ${
|
| 43 |
-
RUN ls -l ${
|
| 44 |
|
| 45 |
USER 999
|
| 46 |
EXPOSE 7860
|
|
|
|
| 1 |
+
FROM registry.gitlab.com/aletrn/my_ghost_writer_base:0.5.3
|
| 2 |
|
| 3 |
LABEL authors="trincadev"
|
| 4 |
|
| 5 |
# Include global arg in this stage of the build
|
| 6 |
+
ARG HOME="/home/python"
|
| 7 |
+
ENV VIRTUAL_ENV=${HOME}/.venv PATH="${HOME}/.venv/bin:$PATH"
|
| 8 |
ENV WRITE_TMP_ON_DISK=""
|
| 9 |
ENV MOUNT_GRADIO_APP=""
|
|
|
|
| 10 |
ENV SPACY_MODEL="en_core_web_sm"
|
| 11 |
|
| 12 |
# Set working directory to function root directory
|
| 13 |
+
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
# RUN . ${HOME}/.venv && which python && echo "# install samgis #" && pip install .
|
| 16 |
RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then mkdir {WRITE_TMP_ON_DISK}; fi
|
| 17 |
RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then ls -l {WRITE_TMP_ON_DISK}; fi
|
| 18 |
|
|
|
|
| 21 |
RUN python --version
|
| 22 |
RUN pip list
|
| 23 |
RUN echo "PATH: ${PATH}."
|
| 24 |
+
RUN echo "HOME: ${HOME}."
|
| 25 |
+
RUN ls -l ${HOME}
|
| 26 |
+
RUN ls -ld ${HOME}
|
| 27 |
+
RUN ls -l ${HOME}/
|
| 28 |
RUN python -c "import sys; print(sys.path)"
|
| 29 |
RUN python -c "import spacy"
|
| 30 |
RUN echo "python -m spacy download \"${SPACY_MODEL}\""
|
|
|
|
| 34 |
RUN python -c "import pymongo"
|
| 35 |
RUN python -c "import requests"
|
| 36 |
RUN df -h
|
| 37 |
+
RUN ls -l ${HOME}/my_ghost_writer/app.py
|
| 38 |
+
RUN ls -l ${HOME}/static/index.html
|
| 39 |
+
RUN ls -l ${HOME}/lite.koboldai.net/index.html
|
| 40 |
|
| 41 |
USER 999
|
| 42 |
EXPOSE 7860
|
README.md
CHANGED
|
@@ -4,6 +4,7 @@ emoji: ✍️
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: true
|
| 8 |
license: agpl-3.0
|
| 9 |
---
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: true
|
| 9 |
license: agpl-3.0
|
| 10 |
---
|
dockerfiles/dockerfile_my_ghost_writer_base
CHANGED
|
@@ -1,19 +1,18 @@
|
|
| 1 |
# Include global ARGs at the dockerfile top
|
| 2 |
ARG ARCH="x86_64"
|
| 3 |
-
ARG
|
| 4 |
-
ARG FASTAPI_STATIC="${
|
| 5 |
-
ARG PYTHONPATH="${
|
| 6 |
ARG POETRY_NO_INTERACTION=1
|
| 7 |
ARG POETRY_VIRTUALENVS_IN_PROJECT=1
|
| 8 |
ARG POETRY_VIRTUALENVS_CREATE=1
|
| 9 |
ARG POETRY_CACHE_DIR=/tmp/poetry_cache
|
| 10 |
-
ARG
|
| 11 |
|
| 12 |
FROM python:3.13-bookworm AS builder_global
|
| 13 |
LABEL authors="trincadev"
|
| 14 |
|
| 15 |
ARG ARCH
|
| 16 |
-
ARG WORKDIR_ROOT
|
| 17 |
ARG PYTHONPATH
|
| 18 |
ARG POETRY_NO_INTERACTION
|
| 19 |
ARG POETRY_VIRTUALENVS_IN_PROJECT
|
|
@@ -21,61 +20,59 @@ ARG POETRY_VIRTUALENVS_CREATE
|
|
| 21 |
ARG POETRY_CACHE_DIR
|
| 22 |
|
| 23 |
RUN echo "ARCH: $ARCH ..."
|
| 24 |
-
RUN echo "
|
| 25 |
RUN echo "PYTHONPATH: ${PYTHONPATH} ..."
|
| 26 |
-
RUN echo "HOME_USER: ${HOME_USER} ..."
|
| 27 |
RUN echo "==========================="
|
| 28 |
|
| 29 |
RUN echo "ARG POETRY_CACHE_DIR: ${POETRY_CACHE_DIR} ..."
|
| 30 |
RUN echo "ARG PYTHONPATH: $PYTHONPATH ..."
|
| 31 |
RUN echo "arg dep:"
|
| 32 |
|
| 33 |
-
RUN ls -ld ${HOME_USER}
|
| 34 |
-
RUN ls -l ${HOME_USER}
|
| 35 |
RUN groupadd -g 999 python && useradd -r -u 999 -g python python
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# Set working directory to function root directory
|
| 37 |
-
|
| 38 |
-
WORKDIR ${WORKDIR_ROOT}
|
| 39 |
-
COPY --chown=python:python requirements_poetry.txt pyproject.toml poetry.lock README.md ${WORKDIR_ROOT}/
|
| 40 |
|
| 41 |
-
# poetry installation path is NOT within ${
|
| 42 |
-
RUN python -m pip install -r ${
|
| 43 |
|
| 44 |
RUN which poetry && poetry --version && poetry config --list
|
| 45 |
-
RUN poetry config virtualenvs.path ${
|
| 46 |
RUN echo "# poetry config --list #" && poetry config --list
|
| 47 |
RUN poetry install --with webserver --no-cache
|
| 48 |
|
| 49 |
FROM python:3.13-slim-bookworm AS runtime
|
| 50 |
|
| 51 |
ARG ARCH
|
| 52 |
-
ARG
|
| 53 |
-
ARG HOME_USER
|
| 54 |
|
| 55 |
-
ENV VIRTUAL_ENV=${
|
| 56 |
|
| 57 |
# workaround for missing /home folder
|
| 58 |
RUN mkdir -p /home
|
| 59 |
RUN groupadd -g 999 python && useradd -r -u 999 -g python python
|
| 60 |
RUN ls -l /home
|
| 61 |
RUN ls -ld /home
|
| 62 |
-
RUN mkdir -p ${
|
| 63 |
-
RUN ls -ld ${
|
| 64 |
-
RUN ls -lA ${
|
| 65 |
-
|
| 66 |
|
| 67 |
-
COPY --from=builder_global ${
|
| 68 |
-
RUN . ${
|
| 69 |
|
| 70 |
-
COPY --chown=python:python ./lite.koboldai.net ${
|
| 71 |
-
COPY --chown=python:python ./my_ghost_writer ${
|
| 72 |
-
RUN mkdir ${
|
| 73 |
-
COPY --chown=python:python static/index-dark.css static/index.html static/index_dark.html static/index.css static/index.js ${
|
| 74 |
|
| 75 |
-
RUN echo "new
|
| 76 |
-
RUN ls -ld ${
|
| 77 |
-
RUN ls -lA ${
|
| 78 |
-
RUN ls -l ${
|
| 79 |
-
RUN ls -l ${
|
| 80 |
-
RUN ls -l ${
|
| 81 |
-
RUN ls -l ${
|
|
|
|
| 1 |
# Include global ARGs at the dockerfile top
|
| 2 |
ARG ARCH="x86_64"
|
| 3 |
+
ARG HOME="/home/python"
|
| 4 |
+
ARG FASTAPI_STATIC="${HOME}/static"
|
| 5 |
+
ARG PYTHONPATH="${HOME}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
|
| 6 |
ARG POETRY_NO_INTERACTION=1
|
| 7 |
ARG POETRY_VIRTUALENVS_IN_PROJECT=1
|
| 8 |
ARG POETRY_VIRTUALENVS_CREATE=1
|
| 9 |
ARG POETRY_CACHE_DIR=/tmp/poetry_cache
|
| 10 |
+
ARG HOME=/home/python
|
| 11 |
|
| 12 |
FROM python:3.13-bookworm AS builder_global
|
| 13 |
LABEL authors="trincadev"
|
| 14 |
|
| 15 |
ARG ARCH
|
|
|
|
| 16 |
ARG PYTHONPATH
|
| 17 |
ARG POETRY_NO_INTERACTION
|
| 18 |
ARG POETRY_VIRTUALENVS_IN_PROJECT
|
|
|
|
| 20 |
ARG POETRY_CACHE_DIR
|
| 21 |
|
| 22 |
RUN echo "ARCH: $ARCH ..."
|
| 23 |
+
RUN echo "HOME: ${HOME} ..."
|
| 24 |
RUN echo "PYTHONPATH: ${PYTHONPATH} ..."
|
|
|
|
| 25 |
RUN echo "==========================="
|
| 26 |
|
| 27 |
RUN echo "ARG POETRY_CACHE_DIR: ${POETRY_CACHE_DIR} ..."
|
| 28 |
RUN echo "ARG PYTHONPATH: $PYTHONPATH ..."
|
| 29 |
RUN echo "arg dep:"
|
| 30 |
|
|
|
|
|
|
|
| 31 |
RUN groupadd -g 999 python && useradd -r -u 999 -g python python
|
| 32 |
+
RUN mkdir -p ${HOME} ${HOME}/.config && chown python:python -R ${HOME}
|
| 33 |
+
RUN ls -ld ${HOME}
|
| 34 |
+
RUN ls -l ${HOME}
|
| 35 |
+
WORKDIR ${HOME}
|
| 36 |
# Set working directory to function root directory
|
| 37 |
+
COPY --chown=python:python requirements_poetry.txt pyproject.toml poetry.lock README.md ${HOME}/
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
# poetry installation path is NOT within ${HOME}: not needed for runtime docker image
|
| 40 |
+
RUN python -m pip install -r ${HOME}/requirements_poetry.txt
|
| 41 |
|
| 42 |
RUN which poetry && poetry --version && poetry config --list
|
| 43 |
+
RUN poetry config virtualenvs.path ${HOME}
|
| 44 |
RUN echo "# poetry config --list #" && poetry config --list
|
| 45 |
RUN poetry install --with webserver --no-cache
|
| 46 |
|
| 47 |
FROM python:3.13-slim-bookworm AS runtime
|
| 48 |
|
| 49 |
ARG ARCH
|
| 50 |
+
ARG HOME
|
|
|
|
| 51 |
|
| 52 |
+
ENV VIRTUAL_ENV=${HOME}/.venv PATH="${HOME}/.venv/bin:$PATH"
|
| 53 |
|
| 54 |
# workaround for missing /home folder
|
| 55 |
RUN mkdir -p /home
|
| 56 |
RUN groupadd -g 999 python && useradd -r -u 999 -g python python
|
| 57 |
RUN ls -l /home
|
| 58 |
RUN ls -ld /home
|
| 59 |
+
RUN mkdir -p ${HOME} ${HOME}/.config && chown python:python -R ${HOME}
|
| 60 |
+
RUN ls -ld ${HOME}
|
| 61 |
+
RUN ls -lA ${HOME}
|
| 62 |
+
WORKDIR ${HOME}
|
| 63 |
|
| 64 |
+
COPY --from=builder_global ${HOME}/.venv ${HOME}/.venv
|
| 65 |
+
RUN . ${HOME}/.venv && which python && pip list
|
| 66 |
|
| 67 |
+
COPY --chown=python:python ./lite.koboldai.net ${HOME}/lite.koboldai.net
|
| 68 |
+
COPY --chown=python:python ./my_ghost_writer ${HOME}/my_ghost_writer
|
| 69 |
+
RUN mkdir ${HOME}/static && chown python:python ${HOME}/static
|
| 70 |
+
COPY --chown=python:python static/index-dark.css static/index.html static/index_dark.html static/index.css static/index.js ${HOME}/static/
|
| 71 |
|
| 72 |
+
RUN echo "new HOME after hidden venv copy => ${HOME}"
|
| 73 |
+
RUN ls -ld ${HOME}/
|
| 74 |
+
RUN ls -lA ${HOME}/
|
| 75 |
+
RUN ls -l ${HOME}/lite.koboldai.net/index.html
|
| 76 |
+
RUN ls -l ${HOME}/static/index.html
|
| 77 |
+
RUN ls -l ${HOME}/my_ghost_writer/app.py
|
| 78 |
+
RUN ls -l ${HOME}/my_ghost_writer/custom_synonym_handler.py
|
pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
[project]
|
| 2 |
name = "my-ghost-writer"
|
| 3 |
-
version = "0.5.
|
| 4 |
description = "A simple webapp supporting writers"
|
| 5 |
authors = [
|
| 6 |
{name = "alessandro trinca tornidor",email = "[email protected]"}
|
|
|
|
| 1 |
[project]
|
| 2 |
name = "my-ghost-writer"
|
| 3 |
+
version = "0.5.3"
|
| 4 |
description = "A simple webapp supporting writers"
|
| 5 |
authors = [
|
| 6 |
{name = "alessandro trinca tornidor",email = "[email protected]"}
|