Spaces:
Sleeping
Sleeping
Lazar Radojevic
commited on
Commit
·
6b2dc7f
1
Parent(s):
f610704
new dockerfile
Browse files- Dockerfile +22 -8
- run.py +0 -3
Dockerfile
CHANGED
@@ -1,19 +1,33 @@
|
|
1 |
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
# Set
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
RUN
|
9 |
|
10 |
-
#
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Expose the port FastAPI will run on
|
16 |
EXPOSE 7860
|
17 |
|
18 |
# Command to run the FastAPI application
|
19 |
-
CMD ["python", "run.py"]
|
|
|
1 |
# Use the official Python image from the Docker Hub
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# Set environment variables
|
5 |
+
ENV HOME=/home/user \
|
6 |
+
PATH=/home/user/.local/bin:$PATH
|
7 |
|
8 |
+
# Set up a new user named "user" with user ID 1000
|
9 |
+
RUN useradd -m -u 1000 user
|
10 |
|
11 |
+
# Switch to the "user" user
|
12 |
+
USER user
|
13 |
+
|
14 |
+
# Set the working directory to the user's home directory
|
15 |
+
WORKDIR $HOME/app
|
16 |
+
|
17 |
+
# Install pip
|
18 |
+
RUN pip install --no-cache-dir --upgrade pip
|
19 |
|
20 |
+
# Copy only the requirements file and install dependencies
|
21 |
+
COPY --chown=user requirements.txt .
|
22 |
+
|
23 |
+
# Install the application dependencies
|
24 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
25 |
+
|
26 |
+
# Copy the rest of the application code to the working directory
|
27 |
+
COPY --chown=user . .
|
28 |
|
29 |
# Expose the port FastAPI will run on
|
30 |
EXPOSE 7860
|
31 |
|
32 |
# Command to run the FastAPI application
|
33 |
+
CMD ["python", "run.py"]
|
run.py
CHANGED
@@ -5,9 +5,6 @@ from src.search_engine import PromptSearchEngine
|
|
5 |
from src.prompt_loader import PromptLoader
|
6 |
import os
|
7 |
|
8 |
-
os.environ["SENTENCE_TRANSFORMERS_HOME"] = "./.cache"
|
9 |
-
os.environ["HF_HOME"] = "./.cache"
|
10 |
-
|
11 |
# Constants
|
12 |
SEED = 42
|
13 |
DATA_SIZE = 100
|
|
|
5 |
from src.prompt_loader import PromptLoader
|
6 |
import os
|
7 |
|
|
|
|
|
|
|
8 |
# Constants
|
9 |
SEED = 42
|
10 |
DATA_SIZE = 100
|