Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +17 -46
Dockerfile
CHANGED
@@ -1,46 +1,17 @@
|
|
1 |
-
#
|
2 |
-
FROM python:3.
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
ENV PIP_ROOT_USER_ACTION=ignore
|
20 |
-
WORKDIR /usr/src/app
|
21 |
-
|
22 |
-
# Copy and install Python dependencies in a single layer to optimize cache usage
|
23 |
-
COPY ./requirements.txt ./requirements.txt
|
24 |
-
COPY ./multi_agents/requirements.txt ./multi_agents/requirements.txt
|
25 |
-
|
26 |
-
RUN pip install --no-cache-dir -r requirements.txt && \
|
27 |
-
pip install --no-cache-dir -r multi_agents/requirements.txt
|
28 |
-
|
29 |
-
# Stage 3: Final stage with non-root user and app
|
30 |
-
FROM gpt-researcher-install AS gpt-researcher
|
31 |
-
|
32 |
-
# Create a non-root user for security
|
33 |
-
RUN useradd -ms /bin/bash gpt-researcher && \
|
34 |
-
chown -R gpt-researcher:gpt-researcher /usr/src/app
|
35 |
-
|
36 |
-
USER gpt-researcher
|
37 |
-
WORKDIR /usr/src/app
|
38 |
-
|
39 |
-
# Copy the rest of the application files with proper ownership
|
40 |
-
COPY --chown=gpt-researcher:gpt-researcher ./ ./
|
41 |
-
|
42 |
-
# Expose the application's port
|
43 |
-
EXPOSE 8000
|
44 |
-
|
45 |
-
# Define the default command to run the application
|
46 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the current directory contents into the container at /app
|
8 |
+
COPY . /app
|
9 |
+
|
10 |
+
# Install any needed dependencies
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Expose the port the app runs on
|
14 |
+
EXPOSE 8000
|
15 |
+
|
16 |
+
# Run the FastAPI app using Uvicorn
|
17 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|