Yannick Stephan commited on
Commit
d86eab1
·
1 Parent(s): c5c767d

[Project] Updated Docker

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -32
Dockerfile CHANGED
@@ -40,19 +40,18 @@ ENV PYTHONUNBUFFERED=1 \
40
  POETRY_NO_INTERACTION=1 \
41
  ### Define paths for the virtual environment and Python setup
42
  # Define where Python setup files will reside
43
- # Define where the virtual environment will be created
44
  PYSETUP_PATH="/opt/pysetup" \
45
- #PYSETUP_PATH="/opt/pysetup" \
46
  VENV_PATH="/opt/pysetup/.venv" \
47
- # PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" \
48
- ### Hugging Face
49
  # Set Hugging Face to offline mode to avoid network access
50
  HF_HUB_OFFLINE=0 \
 
51
  NLTK_DATA="/home/user/nltk/" \
52
  # Store files
53
  DATA_DIR="/app/data/" \
54
  # Set the custom Poetry configuration directory
55
  POETRY_CONFIG_DIR="$POETRY_HOME/.config/pypoetry" \
 
56
  PASSLIB_BUILTIN_BCRYPT="enabled"
57
 
58
  # Add Poetry and virtual environment to the system PATH (Note add after declared ENV)
@@ -84,56 +83,40 @@ RUN apt-get update \
84
  ### Create DIRs
85
  ### ------
86
 
87
- WORKDIR /app
88
- WORKDIR /repo
89
 
90
  ### ------
91
- ### Git Clone secret
92
  ### ------
93
 
94
  RUN --mount=type=secret,id=TAG,mode=0444,required=true \
95
  --mount=type=secret,id=URL,mode=0444,required=true \
96
  git clone --branch $(cat /run/secrets/TAG) $(cat /run/secrets/URL) /repo
97
 
98
- ### ------
99
- ### Copy file
100
- ### ------
101
-
102
- RUN cp -r /repo/api_writer/* /app/
103
  RUN cp -r /repo/gary /app/gary
 
 
104
  RUN rm -rf /repo
105
 
106
  ### ------
107
- ### Modif path of Lib
108
  ### ------
109
 
110
- WORKDIR /app
 
111
 
112
- RUN sed -i 's/\.\.\/gary/gary/g' pyproject.toml
113
 
114
  ### ------
115
  ### Install project dependencies using Poetry
116
  ### ------
117
 
118
- # Move to gary and install need optional lib
119
- WORKDIR /app/gary
120
- # Install only the dependencies needed (Mango and pymupdf)
121
- RUN poetry install --no-interaction --with mangodb --with pymupdf \
122
- # Clean up the Poetry cache to reduce image size
123
- && rm -rf $POETRY_CACHE_DIR
124
-
125
- WORKDIR /app
126
-
127
- # Optimize Poetry's performance with more parallel workers
128
- RUN poetry config installer.max-workers 10 \
129
- # Install only the dependencies needed
130
- && poetry install --no-interaction --no-dev \
131
- # Clean up the Poetry cache to reduce image size
132
- && rm -rf $POETRY_CACHE_DIR
133
-
134
  # Create the custom Poetry configuration directory and set permissions
135
  RUN mkdir -p $POETRY_CONFIG_DIR && \
136
- # Create the NTLK folder (llama)
137
  mkdir -p $NLTK_DATA && \
138
  # Create the folder store files
139
  mkdir -p $DATA_DIR && \
 
40
  POETRY_NO_INTERACTION=1 \
41
  ### Define paths for the virtual environment and Python setup
42
  # Define where Python setup files will reside
 
43
  PYSETUP_PATH="/opt/pysetup" \
44
+ # Define where the virtual environment will be created
45
  VENV_PATH="/opt/pysetup/.venv" \
 
 
46
  # Set Hugging Face to offline mode to avoid network access
47
  HF_HUB_OFFLINE=0 \
48
+ # NLTK
49
  NLTK_DATA="/home/user/nltk/" \
50
  # Store files
51
  DATA_DIR="/app/data/" \
52
  # Set the custom Poetry configuration directory
53
  POETRY_CONFIG_DIR="$POETRY_HOME/.config/pypoetry" \
54
+ # Crypt
55
  PASSLIB_BUILTIN_BCRYPT="enabled"
56
 
57
  # Add Poetry and virtual environment to the system PATH (Note add after declared ENV)
 
83
  ### Create DIRs
84
  ### ------
85
 
86
+
87
+ RUN mkdir -p /app /repo
88
 
89
  ### ------
90
+ ### Copy from Repo
91
  ### ------
92
 
93
  RUN --mount=type=secret,id=TAG,mode=0444,required=true \
94
  --mount=type=secret,id=URL,mode=0444,required=true \
95
  git clone --branch $(cat /run/secrets/TAG) $(cat /run/secrets/URL) /repo
96
 
97
+ WORKDIR /
98
+ RUN cp -r /repo/api_writer/ /app/api_writer
 
 
 
99
  RUN cp -r /repo/gary /app/gary
100
+ RUN cp -r /repo/flows /app/flows
101
+ RUN cp -r /repo/scripts /app/scripts
102
  RUN rm -rf /repo
103
 
104
  ### ------
105
+ ### Install Libs
106
  ### ------
107
 
108
+ WORKDIR /app/scripts
109
+ RUN ./run_install_writepal_modules.sh
110
 
111
+ RUN rm -rf $POETRY_CACHE_DIR
112
 
113
  ### ------
114
  ### Install project dependencies using Poetry
115
  ### ------
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  # Create the custom Poetry configuration directory and set permissions
118
  RUN mkdir -p $POETRY_CONFIG_DIR && \
119
+ # Create the NTLK folder
120
  mkdir -p $NLTK_DATA && \
121
  # Create the folder store files
122
  mkdir -p $DATA_DIR && \