Spaces:
Sleeping
Sleeping
.......
Browse files- Dockerfile +6 -102
- api/run.py +3 -0
- core/run.py +3 -0
Dockerfile
CHANGED
|
@@ -12,116 +12,20 @@ RUN pip install --user -r ./core/requirements.txt
|
|
| 12 |
FROM python:3.9 AS setup
|
| 13 |
COPY --from=install /root/.local /root/.local
|
| 14 |
|
|
|
|
| 15 |
COPY ./core .
|
| 16 |
-
RUN python ./
|
| 17 |
|
| 18 |
##################################################################
|
| 19 |
FROM python:3.9
|
| 20 |
COPY --from=install /root/.local /root/.local
|
| 21 |
|
|
|
|
|
|
|
| 22 |
COPY ./core ./core
|
| 23 |
COPY ./api ./api
|
| 24 |
|
| 25 |
-
COPY --from=setup /engine.pickle
|
| 26 |
|
| 27 |
EXPOSE 7860
|
| 28 |
-
ENTRYPOINT ["python", "api/
|
| 29 |
-
|
| 30 |
-
# # First stage: Build and load the dataset
|
| 31 |
-
# FROM python:3.9 as core
|
| 32 |
-
#
|
| 33 |
-
# # Set the working directory
|
| 34 |
-
# WORKDIR /app
|
| 35 |
-
#
|
| 36 |
-
# # Copy and install core requirements
|
| 37 |
-
# COPY ./core/requirements.txt ./core/requirements.txt
|
| 38 |
-
# RUN pip install -r ./core/requirements.txt
|
| 39 |
-
#
|
| 40 |
-
# # Copy the core files
|
| 41 |
-
# COPY ./core ./core
|
| 42 |
-
#
|
| 43 |
-
# # Set the PYTHONPATH to include the /app directory
|
| 44 |
-
# ENV PYTHONPATH="/app"
|
| 45 |
-
#
|
| 46 |
-
# # Set the HF_HOME to a writable directory
|
| 47 |
-
# ENV HF_HOME="/app/cache"
|
| 48 |
-
#
|
| 49 |
-
# # Create the cache directory and set correct permissions
|
| 50 |
-
# RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 51 |
-
#
|
| 52 |
-
# # Run the initialization script to load and serialize the dataset
|
| 53 |
-
# RUN python ./core/initialization.py
|
| 54 |
-
#
|
| 55 |
-
# # Second stage: Set up the API
|
| 56 |
-
# FROM python:3.9
|
| 57 |
-
#
|
| 58 |
-
# # Set the working directory
|
| 59 |
-
# WORKDIR /app
|
| 60 |
-
#
|
| 61 |
-
# # Copy and install core and API requirements
|
| 62 |
-
# COPY ./core/requirements.txt ./core/requirements.txt
|
| 63 |
-
# COPY ./api/requirements.txt ./api/requirements.txt
|
| 64 |
-
# RUN pip install -r ./core/requirements.txt
|
| 65 |
-
# RUN pip install -r ./api/requirements.txt
|
| 66 |
-
#
|
| 67 |
-
# # Copy the API files
|
| 68 |
-
# COPY ./api ./api
|
| 69 |
-
#
|
| 70 |
-
# # Copy the core files to the second stage to ensure search_engine is available
|
| 71 |
-
# COPY ./core ./core
|
| 72 |
-
#
|
| 73 |
-
# # Copy the serialized engine from the first stage to the API directory
|
| 74 |
-
# COPY --from=core /app/core/engine.pickle /app/api/engine.pickle
|
| 75 |
-
#
|
| 76 |
-
# # Set the PYTHONPATH to include the /app directory
|
| 77 |
-
# ENV PYTHONPATH="/app"
|
| 78 |
-
#
|
| 79 |
-
# # Set the HF_HOME to a writable directory
|
| 80 |
-
# ENV HF_HOME="/app/cache"
|
| 81 |
-
#
|
| 82 |
-
# # Create the cache directory and set correct permissions
|
| 83 |
-
# RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 84 |
-
#
|
| 85 |
-
# # Expose the API port
|
| 86 |
-
# EXPOSE 7860
|
| 87 |
-
#
|
| 88 |
-
# # Run the service manager
|
| 89 |
-
# ENTRYPOINT ["python", "api/service_manager.py"]
|
| 90 |
-
# FROM python:3.9 as core
|
| 91 |
-
#
|
| 92 |
-
# COPY ./core/requirements.txt ./requirements.txt
|
| 93 |
-
# RUN pip install -r requirements.txt
|
| 94 |
-
#
|
| 95 |
-
# WORKDIR /app/core
|
| 96 |
-
#
|
| 97 |
-
# COPY ./core .
|
| 98 |
-
# RUN python ./initialization.py
|
| 99 |
-
#
|
| 100 |
-
# FROM python:3.9
|
| 101 |
-
#
|
| 102 |
-
# COPY ./api/requirements.txt ./requirements.txt
|
| 103 |
-
# RUN pip install -r requirements.txt
|
| 104 |
-
#
|
| 105 |
-
# WORKDIR /app/api
|
| 106 |
-
# COPY ./api .
|
| 107 |
-
#
|
| 108 |
-
# COPY --from=core /app/engine.pickle /app/engine.pickle
|
| 109 |
-
#
|
| 110 |
-
# EXPOSE 9999
|
| 111 |
-
# ENTRYPOINT ["python", "service_manager.py"]
|
| 112 |
-
|
| 113 |
-
# FROM python:3.9 as build
|
| 114 |
-
#
|
| 115 |
-
# COPY ./requirements.txt ./requirements.txt
|
| 116 |
-
# RUN pip install -r requirements.txt
|
| 117 |
-
#
|
| 118 |
-
# WORKDIR /app
|
| 119 |
-
#
|
| 120 |
-
# COPY . .
|
| 121 |
-
#
|
| 122 |
-
# RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 123 |
-
#
|
| 124 |
-
# ENV TRANSFORMERS_CACHE=/app/cache
|
| 125 |
-
#
|
| 126 |
-
# EXPOSE 9999
|
| 127 |
-
# ENTRYPOINT ["python", "run.py"]
|
|
|
|
| 12 |
FROM python:3.9 AS setup
|
| 13 |
COPY --from=install /root/.local /root/.local
|
| 14 |
|
| 15 |
+
WORKDIR /app
|
| 16 |
COPY ./core .
|
| 17 |
+
RUN python ./run.py
|
| 18 |
|
| 19 |
##################################################################
|
| 20 |
FROM python:3.9
|
| 21 |
COPY --from=install /root/.local /root/.local
|
| 22 |
|
| 23 |
+
WORKDIR /app
|
| 24 |
+
|
| 25 |
COPY ./core ./core
|
| 26 |
COPY ./api ./api
|
| 27 |
|
| 28 |
+
COPY --from=setup /app/engine.pickle ./engine.pickle
|
| 29 |
|
| 30 |
EXPOSE 7860
|
| 31 |
+
ENTRYPOINT ["python", "api/run.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
api/run.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import service_manager
|
| 2 |
+
|
| 3 |
+
service_manager.run()
|
core/run.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import initialization
|
| 2 |
+
|
| 3 |
+
initialization.run()
|