Sean-Case commited on
Commit
9c0a094
1 Parent(s): 29ce26a

ECS not allowing me to save files so increasing container privileges in Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -8
  2. app.py +7 -1
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # First stage: build dependencies
2
- FROM public.ecr.aws/docker/library/python:3.10.13-slim AS build
3
 
4
  # Install wget
5
  RUN apt-get update && apt-get install -y wget
@@ -20,14 +20,11 @@ RUN git lfs install
20
  RUN git clone https://huggingface.co/BAAI/bge-small-en-v1.5 /model/bge
21
  RUN rm -rf /model/bge/.git
22
 
23
- # Second stage: final image
24
- FROM build AS final
25
-
26
  # Set up a new user named "user" with user ID 1000
27
- RUN useradd -m -u 1000 user
28
 
29
  # Switch to the "user" user
30
- USER user
31
 
32
  # Set home to the user's home directory
33
  ENV HOME=/home/user \
@@ -38,13 +35,14 @@ ENV HOME=/home/user \
38
  GRADIO_NUM_PORTS=1 \
39
  GRADIO_SERVER_NAME=0.0.0.0 \
40
  GRADIO_THEME=huggingface \
41
- GRADIO_ROOT_PATH=/data_text_search \
42
  SYSTEM=spaces
43
 
44
  # Set the working directory to the user's home directory
45
  WORKDIR $HOME/app
46
 
47
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
48
- COPY --chown=user . $HOME/app
 
49
 
50
  CMD ["python", "app.py"]
 
1
  # First stage: build dependencies
2
+ FROM public.ecr.aws/docker/library/python:3.10.13-slim
3
 
4
  # Install wget
5
  RUN apt-get update && apt-get install -y wget
 
20
  RUN git clone https://huggingface.co/BAAI/bge-small-en-v1.5 /model/bge
21
  RUN rm -rf /model/bge/.git
22
 
 
 
 
23
  # Set up a new user named "user" with user ID 1000
24
+ #RUN useradd -m -u 1000 user
25
 
26
  # Switch to the "user" user
27
+ #USER user
28
 
29
  # Set home to the user's home directory
30
  ENV HOME=/home/user \
 
35
  GRADIO_NUM_PORTS=1 \
36
  GRADIO_SERVER_NAME=0.0.0.0 \
37
  GRADIO_THEME=huggingface \
38
+ #GRADIO_ROOT_PATH=/data_text_search \
39
  SYSTEM=spaces
40
 
41
  # Set the working directory to the user's home directory
42
  WORKDIR $HOME/app
43
 
44
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
45
+ #COPY --chown=user . $HOME/app
46
+ COPY . $HOME/app
47
 
48
  CMD ["python", "app.py"]
app.py CHANGED
@@ -12,6 +12,9 @@ from search_funcs.semantic_functions import docs_to_bge_embed_np_array, bge_simp
12
  from search_funcs.helper_functions import display_info, initial_data_load, put_columns_in_join_df, get_temp_folder_path, empty_folder
13
  from search_funcs.spacy_search_funcs import spacy_fuzzy_search
14
 
 
 
 
15
  # Attempt to delete temporary files generated by previous use of the app (as the files can be very big!)
16
  temp_folder_path = get_temp_folder_path()
17
  empty_folder(temp_folder_path)
@@ -19,6 +22,7 @@ empty_folder(temp_folder_path)
19
  ## Gradio app - BM25 search
20
  block = gr.Blocks(theme = gr.themes.Base())
21
 
 
22
  with block:
23
  print("Please don't close this window! Open the below link in the web browser of your choice.")
24
 
@@ -193,7 +197,9 @@ depends on factors such as the type of documents or queries. Information taken f
193
  #block.queue().launch(debug=True)
194
 
195
  # Running on local server without specifying port
196
- block.queue().launch(server_name="0.0.0.0")
 
 
197
 
198
  # Running on local server without https
199
  #block.queue().launch(server_name="0.0.0.0", server_port=7861, ssl_verify=False)
 
12
  from search_funcs.helper_functions import display_info, initial_data_load, put_columns_in_join_df, get_temp_folder_path, empty_folder
13
  from search_funcs.spacy_search_funcs import spacy_fuzzy_search
14
 
15
+ from fastapi import FastAPI
16
+ app = FastAPI()
17
+
18
  # Attempt to delete temporary files generated by previous use of the app (as the files can be very big!)
19
  temp_folder_path = get_temp_folder_path()
20
  empty_folder(temp_folder_path)
 
22
  ## Gradio app - BM25 search
23
  block = gr.Blocks(theme = gr.themes.Base())
24
 
25
+
26
  with block:
27
  print("Please don't close this window! Open the below link in the web browser of your choice.")
28
 
 
197
  #block.queue().launch(debug=True)
198
 
199
  # Running on local server without specifying port
200
+ block.queue().launch(server_name="0.0.0.0")#, root_path="/data_text_search")
201
+
202
+ #app = gr.mount_gradio_app(app, block, path="/data_text_search")
203
 
204
  # Running on local server without https
205
  #block.queue().launch(server_name="0.0.0.0", server_port=7861, ssl_verify=False)