Spaces:
Sleeping
Sleeping
fixed imports and changed dockerfile
Browse files- Dockerfile +15 -0
- core/initialization.py +2 -2
Dockerfile
CHANGED
@@ -1,27 +1,42 @@
|
|
|
|
1 |
FROM python:3.9 as core
|
2 |
|
|
|
3 |
WORKDIR /app/core
|
4 |
|
|
|
5 |
COPY ./core/requirements.txt ./requirements.txt
|
6 |
RUN pip install -r requirements.txt
|
7 |
|
|
|
8 |
COPY ./core .
|
9 |
|
|
|
|
|
|
|
|
|
10 |
RUN python initialization.py
|
11 |
|
|
|
12 |
FROM python:3.9
|
13 |
|
|
|
14 |
WORKDIR /app/api
|
15 |
|
|
|
16 |
COPY ./api/requirements.txt ./requirements.txt
|
17 |
RUN pip install -r requirements.txt
|
18 |
|
|
|
19 |
COPY ./api .
|
20 |
|
|
|
21 |
COPY --from=core /app/core/engine.pickle /app/api/engine.pickle
|
22 |
|
|
|
23 |
EXPOSE 9999
|
24 |
|
|
|
25 |
ENTRYPOINT ["python", "service_manager.py"]
|
26 |
|
27 |
# FROM python:3.9 as core
|
|
|
1 |
+
# First stage: Build and load the dataset
|
2 |
FROM python:3.9 as core
|
3 |
|
4 |
+
# Set the working directory
|
5 |
WORKDIR /app/core
|
6 |
|
7 |
+
# Copy and install core requirements
|
8 |
COPY ./core/requirements.txt ./requirements.txt
|
9 |
RUN pip install -r requirements.txt
|
10 |
|
11 |
+
# Copy the core files
|
12 |
COPY ./core .
|
13 |
|
14 |
+
# Set the PYTHONPATH to include the /app/core directory
|
15 |
+
ENV PYTHONPATH="/app/core"
|
16 |
+
|
17 |
+
# Run the initialization script to load and serialize the dataset
|
18 |
RUN python initialization.py
|
19 |
|
20 |
+
# Second stage: Set up the API
|
21 |
FROM python:3.9
|
22 |
|
23 |
+
# Set the working directory
|
24 |
WORKDIR /app/api
|
25 |
|
26 |
+
# Copy and install API requirements
|
27 |
COPY ./api/requirements.txt ./requirements.txt
|
28 |
RUN pip install -r requirements.txt
|
29 |
|
30 |
+
# Copy the API files
|
31 |
COPY ./api .
|
32 |
|
33 |
+
# Copy the serialized engine from the first stage
|
34 |
COPY --from=core /app/core/engine.pickle /app/api/engine.pickle
|
35 |
|
36 |
+
# Expose the API port
|
37 |
EXPOSE 9999
|
38 |
|
39 |
+
# Run the service manager
|
40 |
ENTRYPOINT ["python", "service_manager.py"]
|
41 |
|
42 |
# FROM python:3.9 as core
|
core/initialization.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import dill
|
2 |
-
from .search_engine import PromptSearchEngine
|
3 |
-
from .data.dataset import PromptDataset
|
4 |
|
5 |
|
6 |
def run():
|
|
|
1 |
import dill
|
2 |
+
from core.search_engine import PromptSearchEngine
|
3 |
+
from core.data.dataset import PromptDataset
|
4 |
|
5 |
|
6 |
def run():
|