YanSte commited on
Commit
c436684
·
1 Parent(s): c371247

[Project] Added update libs

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -33
Dockerfile CHANGED
@@ -48,7 +48,7 @@ ENV PYTHONUNBUFFERED=1 \
48
  # NLTK
49
  NLTK_DATA="/home/user/nltk/" \
50
  # Store files
51
- DATA_DIR="/app/api_writer/data/" \
52
  # Set the custom Poetry configuration directory
53
  POETRY_CONFIG_DIR="$POETRY_HOME/.config/pypoetry" \
54
  # Crypt
@@ -79,11 +79,25 @@ RUN apt-get update \
79
  # Remove leftover lists to further reduce image size
80
  && rm -rf /var/lib/apt/lists/*
81
 
 
 
 
 
82
  ### ------
83
  ### Create DIRs
84
  ### ------
85
 
86
- RUN mkdir -p /app /repo
 
 
 
 
 
 
 
 
 
 
87
 
88
  ### ------
89
  ### Copy from Repo
@@ -91,47 +105,20 @@ RUN mkdir -p /app /repo
91
 
92
  RUN --mount=type=secret,id=TAG,mode=0444,required=true \
93
  --mount=type=secret,id=URL,mode=0444,required=true \
94
- git clone --branch $(cat /run/secrets/TAG) $(cat /run/secrets/URL) /repo
95
-
96
- WORKDIR /
97
- RUN cp -r /repo/api_writer/ /app/api_writer
98
- RUN cp -r /repo/gary /app/gary
99
- RUN cp -r /repo/flows /app/flows
100
- RUN cp -r /repo/scripts /app/scripts
101
-
102
 
103
  ### ------
104
  ### Install Libs
105
  ### ------
106
 
107
- WORKDIR /app/scripts
108
- RUN ./run_install_writepal_modules.sh
109
-
110
- WORKDIR /
111
- RUN rm -rf /repo
112
- RUN rm -rf $POETRY_CACHE_DIR
113
-
114
- ### ------
115
- ### Install project dependencies using Poetry
116
- ### ------
117
-
118
- # Create the custom Poetry configuration directory and set permissions
119
- RUN mkdir -p $POETRY_CONFIG_DIR && \
120
- # Create the NTLK folder
121
- mkdir -p $NLTK_DATA && \
122
- # Create the folder store files
123
- mkdir -p $DATA_DIR && \
124
- chown -R user:user $POETRY_CONFIG_DIR && \
125
- chown -R user:user $NLTK_DATA && \
126
- chown -R user:user $DATA_DIR && \
127
- chmod -R 777 $DATA_DIR
128
 
129
  ### ------
130
  ### Command to run
131
  ### ------
132
- USER user
133
 
134
- WORKDIR /app/api_writer
135
 
136
  # Expose the port FastAPI will run on
137
  EXPOSE 7860
 
48
  # NLTK
49
  NLTK_DATA="/home/user/nltk/" \
50
  # Store files
51
+ DATA_DIR="/app/api/data/" \
52
  # Set the custom Poetry configuration directory
53
  POETRY_CONFIG_DIR="$POETRY_HOME/.config/pypoetry" \
54
  # Crypt
 
79
  # Remove leftover lists to further reduce image size
80
  && rm -rf /var/lib/apt/lists/*
81
 
82
+
83
+
84
+ WORKDIR /
85
+
86
  ### ------
87
  ### Create DIRs
88
  ### ------
89
 
90
+ # Create the custom Poetry configuration directory and set permissions
91
+ RUN mkdir -p /api && \
92
+ mkdir -p $POETRY_CONFIG_DIR && \
93
+ # Create the NTLK folder
94
+ mkdir -p $NLTK_DATA && \
95
+ # Create the folder store files
96
+ mkdir -p $DATA_DIR && \
97
+ chown -R user:user $POETRY_CONFIG_DIR && \
98
+ chown -R user:user $NLTK_DATA && \
99
+ chown -R user:user $DATA_DIR && \
100
+ chmod -R 777 $DATA_DIR
101
 
102
  ### ------
103
  ### Copy from Repo
 
105
 
106
  RUN --mount=type=secret,id=TAG,mode=0444,required=true \
107
  --mount=type=secret,id=URL,mode=0444,required=true \
108
+ git clone --branch $(cat /run/secrets/TAG) $(cat /run/secrets/URL) /api
 
 
 
 
 
 
 
109
 
110
  ### ------
111
  ### Install Libs
112
  ### ------
113
 
114
+ WORKDIR /api
115
+ RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  ### ------
118
  ### Command to run
119
  ### ------
 
120
 
121
+ USER user
122
 
123
  # Expose the port FastAPI will run on
124
  EXPOSE 7860