alessandro trinca tornidor commited on
Commit
3550787
·
1 Parent(s): e71a006

ci: remove the submodule and during the current docker build we download instead the files from the repositories OR copy from the current directory

Browse files
.dockerignore CHANGED
@@ -21,5 +21,4 @@ mongo/
21
  .history/
22
  .continue/
23
  .vscode/
24
- scripts/
25
  tests/
 
21
  .history/
22
  .continue/
23
  .vscode/
 
24
  tests/
.gitignore CHANGED
@@ -667,4 +667,6 @@ $RECYCLE.BIN/
667
  # custom
668
  # onnx models
669
  *.onnx
670
- tmp/*
 
 
 
667
  # custom
668
  # onnx models
669
  *.onnx
670
+ tmp/*
671
+ lite.koboldai.net
672
+ lite.koboldai.net/*
.gitmodules CHANGED
@@ -1,3 +0,0 @@
1
- [submodule "lite.koboldai.net"]
2
- path = lite.koboldai.net
3
- url = [email protected]:aletrn/lite.koboldai.net.git
 
 
 
 
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM registry.gitlab.com/aletrn/my_ghost_writer_base:0.5.3
2
 
3
  LABEL authors="trincadev"
4
 
@@ -8,10 +8,28 @@ 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
 
1
+ FROM registry.gitlab.com/aletrn/my_ghost_writer_base:0.6.0
2
 
3
  LABEL authors="trincadev"
4
 
 
8
  ENV WRITE_TMP_ON_DISK=""
9
  ENV MOUNT_GRADIO_APP=""
10
  ENV SPACY_MODEL="en_core_web_sm"
11
+ ENV BASEURL1=https://raw.githubusercontent.com/trincadev/lite.koboldai.net/refs/heads/mgw_smart_thesaurus
12
+ ENV BASEURL2=https://gitlab.com/aletrn/my_ghost_writer/-/raw/main
13
 
14
  # Set working directory to function root directory
15
  WORKDIR ${HOME}
16
 
17
+ RUN mkdir ${HOME}/lite.koboldai.net && chown python:python ${HOME}/lite.koboldai.net
18
+ RUN mkdir ${HOME}/my_ghost_writer && chown python:python ${HOME}/my_ghost_writer
19
+ #COPY --chown=python:python ./lite.koboldai.net* ${HOME}/lite.koboldai.net
20
+ #COPY --chown=python:python ./my_ghost_writer* ${HOME}/my_ghost_writer
21
+
22
+ # for lite.koboldai.net.txt we don't need the folder name: we are splitting the paths to keep only the filenames
23
+ # ${x##*/} will keep only the filename, in case of lite.koboldai.net
24
+ RUN ls -l ${HOME}/lite.koboldai.net/index.html || for x in $(cat ${HOME}/lite.koboldai.net.txt); do ${HOME}/download.sh "${BASEURL1}/${x##*/}" ${HOME}/lite.koboldai.net/; done
25
+ RUN ls -l ${HOME}/lite.koboldai.net/index.html || echo "did you checked if the files list from lite.koboldai.net.txt is ok? Maybe not keeping only the filenames?"
26
+ RUN ls -l ${HOME}/lite.koboldai.net/index.html
27
+
28
+ RUN ls -l ${HOME}/my_ghost_writer/app.py || for x in $(cat ${HOME}/my_ghost_writer.txt); do ${HOME}/download.sh "${BASEURL2}/$x" ${HOME}/my_ghost_writer/; done
29
+ RUN ls -l ${HOME}/my_ghost_writer/app.py
30
+ RUN ls -l ${HOME}/my_ghost_writer/custom_synonym_handler.py
31
+ RUN rm ./download.sh
32
+
33
  # RUN . ${HOME}/.venv && which python && echo "# install samgis #" && pip install .
34
  RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then mkdir {WRITE_TMP_ON_DISK}; fi
35
  RUN if [ "${WRITE_TMP_ON_DISK}" != "" ]; then ls -l {WRITE_TMP_ON_DISK}; fi
dockerfiles/dockerfile_my_ghost_writer_base CHANGED
@@ -18,6 +18,7 @@ ARG POETRY_NO_INTERACTION
18
  ARG POETRY_VIRTUALENVS_IN_PROJECT
19
  ARG POETRY_VIRTUALENVS_CREATE
20
  ARG POETRY_CACHE_DIR
 
21
 
22
  RUN echo "ARCH: $ARCH ..."
23
  RUN echo "HOME: ${HOME} ..."
@@ -64,15 +65,14 @@ WORKDIR ${HOME}
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
 
18
  ARG POETRY_VIRTUALENVS_IN_PROJECT
19
  ARG POETRY_VIRTUALENVS_CREATE
20
  ARG POETRY_CACHE_DIR
21
+ ARG HOME
22
 
23
  RUN echo "ARCH: $ARCH ..."
24
  RUN echo "HOME: ${HOME} ..."
 
65
  COPY --from=builder_global ${HOME}/.venv ${HOME}/.venv
66
  RUN . ${HOME}/.venv && which python && pip list
67
 
 
 
68
  RUN mkdir ${HOME}/static && chown python:python ${HOME}/static
69
  COPY --chown=python:python static/index-dark.css static/index.html static/index_dark.html static/index.css static/index.js ${HOME}/static/
70
+ COPY --chown=python:python lite.koboldai.net.txt my_ghost_writer.txt ${HOME}/
71
+ COPY --chown=python:python scripts/download.sh scripts/download_file.py ${HOME}/
72
+ RUN chmod +x ${HOME}/download.sh
73
 
74
  RUN echo "new HOME after hidden venv copy => ${HOME}"
75
  RUN ls -ld ${HOME}/
76
  RUN ls -lA ${HOME}/
 
77
  RUN ls -l ${HOME}/static/index.html
78
+
 
lite.koboldai.net DELETED
@@ -1 +0,0 @@
1
- Subproject commit eee9cdcd9978d4285d78c061b16ceafc5acb2192
 
 
lite.koboldai.net.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ lite.koboldai.net/niko.png
2
+ lite.koboldai.net/package.json
3
+ lite.koboldai.net/koboldcpp_api.json
4
+ lite.koboldai.net/kudorank.html
5
+ lite.koboldai.net/sw.js
6
+ lite.koboldai.net/README.md
7
+ lite.koboldai.net/CNAME
8
+ lite.koboldai.net/LICENSE.md
9
+ lite.koboldai.net/preview2.png
10
+ lite.koboldai.net/manifest.json
11
+ lite.koboldai.net/koboldcpp_api.html
12
+ lite.koboldai.net/preview1.png
13
+ lite.koboldai.net/index.html
my_ghost_writer.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ my_ghost_writer/__init__.py
2
+ my_ghost_writer/custom_synonym_handler.py
3
+ my_ghost_writer/thesaurus.py
4
+ my_ghost_writer/constants.py
5
+ my_ghost_writer/middlewares.py
6
+ my_ghost_writer/exception_handlers.py
7
+ my_ghost_writer/text_parsers.py
8
+ my_ghost_writer/api_clients/a.txt
9
+ my_ghost_writer/app.py
10
+ my_ghost_writer/pymongo_operations_rw.py
11
+ my_ghost_writer/pymongo_utils.py
12
+ my_ghost_writer/session_logger.py
13
+ my_ghost_writer/text_parsers2.py
14
+ my_ghost_writer/__version__.py
15
+ my_ghost_writer/type_hints.py
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
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]"}
 
1
  [project]
2
  name = "my-ghost-writer"
3
+ version = "0.6.0"
4
  description = "A simple webapp supporting writers"
5
  authors = [
6
  {name = "alessandro trinca tornidor",email = "[email protected]"}
scripts/download.sh ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Check if a URL is provided as an argument
4
+ OUTPUT_FOLDER=$2
5
+ if [ -z "$1" ] || [ -z "$2" ]; then
6
+ echo "Usage: $0 <URL> <OUTPUT_FOLDER>"
7
+ exit 1
8
+ fi
9
+
10
+ URL="$1"
11
+ FILENAME=$(basename "$URL")
12
+ echo "Downloading '${FILENAME}' from '${URL}'"
13
+
14
+ # Run the Python script
15
+ python3 ./download_file.py "${URL}" "${OUTPUT_FOLDER}/${FILENAME}"
16
+
17
+ exit 0
scripts/download_file.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import sys
3
+
4
+
5
+ if __name__ == '__main__':
6
+ url = sys.argv[1]
7
+ filename = sys.argv[2]
8
+
9
+ try:
10
+ response = requests.get(url, stream=True)
11
+ response.raise_for_status() # Raise an exception for HTTP errors
12
+
13
+ print(f"saving file to '{filename}'")
14
+ with open(filename, 'wb') as f:
15
+ for chunk in response.iter_content(chunk_size=8192):
16
+ f.write(chunk)
17
+ print(f"Successfully downloaded '{filename}' from '{url}'")
18
+ except requests.exceptions.RequestException as e:
19
+ print(f"Error downloading the file: '{e}'")
20
+ sys.exit(1)