Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +49 -46
Dockerfile
CHANGED
@@ -1,47 +1,50 @@
|
|
1 |
-
# Use a more recent, slim Python base image
|
2 |
-
FROM python:3.10-slim
|
3 |
-
|
4 |
-
# Set the working directory in the container
|
5 |
-
WORKDIR /app
|
6 |
-
|
7 |
-
# Prevent Python from writing pyc files to disc (optional)
|
8 |
-
ENV PYTHONDONTWRITEBYTECODE 1
|
9 |
-
# Ensure Python output is sent straight to terminal (useful for logs)
|
10 |
-
ENV PYTHONUNBUFFERED 1
|
11 |
-
|
12 |
-
# Upgrade pip
|
13 |
-
RUN python -m pip install --upgrade pip
|
14 |
-
|
15 |
-
# Copy the requirements file into the container
|
16 |
-
COPY requirements.txt .
|
17 |
-
|
18 |
-
# Install dependencies
|
19 |
-
# --no-cache-dir reduces image size
|
20 |
-
# --default-timeout=100 increases timeout for pip install
|
21 |
-
RUN pip install --no-cache-dir --default-timeout=100 -r requirements.txt
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
#
|
32 |
-
|
33 |
-
|
34 |
-
#
|
35 |
-
|
36 |
-
|
37 |
-
#
|
38 |
-
|
39 |
-
|
40 |
-
#
|
41 |
-
#
|
42 |
-
#
|
43 |
-
#
|
44 |
-
#
|
45 |
-
#
|
46 |
-
#
|
|
|
|
|
|
|
47 |
# and Neo4j, not local Hugging Face/PyTorch models needing specific cache dirs.
|
|
|
1 |
+
# Use a more recent, slim Python base image
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Prevent Python from writing pyc files to disc (optional)
|
8 |
+
ENV PYTHONDONTWRITEBYTECODE 1
|
9 |
+
# Ensure Python output is sent straight to terminal (useful for logs)
|
10 |
+
ENV PYTHONUNBUFFERED 1
|
11 |
+
|
12 |
+
# Upgrade pip
|
13 |
+
RUN python -m pip install --upgrade pip
|
14 |
+
|
15 |
+
# Copy the requirements file into the container
|
16 |
+
COPY requirements.txt .
|
17 |
+
|
18 |
+
# Install dependencies
|
19 |
+
# --no-cache-dir reduces image size
|
20 |
+
# --default-timeout=100 increases timeout for pip install
|
21 |
+
RUN pip install --no-cache-dir --default-timeout=100 -r requirements.txt
|
22 |
+
|
23 |
+
|
24 |
+
COPY .env .
|
25 |
+
|
26 |
+
# Copy the application code into the container
|
27 |
+
# This includes the API file and the core logic directory
|
28 |
+
COPY api.py .
|
29 |
+
COPY ./kig_core ./kig_core
|
30 |
+
|
31 |
+
# Expose the port the API runs on (defined in api.py/uvicorn command)
|
32 |
+
EXPOSE 8000
|
33 |
+
|
34 |
+
# Command to run the Uvicorn server
|
35 |
+
# It will look for an object named 'app' in the 'api.py' file
|
36 |
+
# Runs on port 8000 and listens on all interfaces (0.0.0.0)
|
37 |
+
# Note: For production, consider removing --reload
|
38 |
+
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
|
39 |
+
|
40 |
+
# --- Notes ---
|
41 |
+
# Environment Variables:
|
42 |
+
# This Dockerfile assumes you will provide necessary environment variables
|
43 |
+
# (NEO4J_URI, NEO4J_PASSWORD, GEMINI_API_KEY, OPENAI_API_KEY, etc.)
|
44 |
+
# when running the container, for example using 'docker run -e VAR=value ...'
|
45 |
+
# or a docker-compose.yml file.
|
46 |
+
# DO NOT hardcode secrets directly in the Dockerfile.
|
47 |
+
#
|
48 |
+
# Cache Folders:
|
49 |
+
# Removed HF_HOME/TORCH_HOME as this app primarily uses external APIs (Gemini/OpenAI)
|
50 |
# and Neo4j, not local Hugging Face/PyTorch models needing specific cache dirs.
|