Spaces:
Sleeping
Sleeping
Commit
·
020ff75
1
Parent(s):
94673bc
updated docker file
Browse files- .ipynb_checkpoints/Dockerfile-checkpoint +33 -0
- Dockerfile +4 -1
- start.sh +7 -0
.ipynb_checkpoints/Dockerfile-checkpoint
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 requirements file
|
8 |
+
COPY requirements.txt .
|
9 |
+
|
10 |
+
# Install any needed packages specified in requirements.txt
|
11 |
+
RUN pip install --upgrade pip
|
12 |
+
|
13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
14 |
+
|
15 |
+
RUN pip install --no-cache-dir torch transformers
|
16 |
+
|
17 |
+
# Install supervisor to manage multiple processes
|
18 |
+
RUN apt-get update && apt-get install -y supervisor \
|
19 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
20 |
+
|
21 |
+
# Copy the application code
|
22 |
+
COPY . .
|
23 |
+
|
24 |
+
# Expose the necessary ports
|
25 |
+
EXPOSE 8501 8502
|
26 |
+
|
27 |
+
# Create a supervisor configuration file
|
28 |
+
RUN mkdir -p /etc/supervisor/conf.d/
|
29 |
+
|
30 |
+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
31 |
+
|
32 |
+
# Command to start supervisor
|
33 |
+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
Dockerfile
CHANGED
@@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y supervisor \
|
|
21 |
# Copy the application code
|
22 |
COPY . .
|
23 |
|
|
|
|
|
24 |
# Expose the necessary ports
|
25 |
EXPOSE 8501 8502
|
26 |
|
@@ -30,4 +32,5 @@ RUN mkdir -p /etc/supervisor/conf.d/
|
|
30 |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
31 |
|
32 |
# Command to start supervisor
|
33 |
-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
|
|
|
21 |
# Copy the application code
|
22 |
COPY . .
|
23 |
|
24 |
+
RUN chmod +x /app/start.sh
|
25 |
+
|
26 |
# Expose the necessary ports
|
27 |
EXPOSE 8501 8502
|
28 |
|
|
|
32 |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
33 |
|
34 |
# Command to start supervisor
|
35 |
+
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
36 |
+
CMD ["/app/start.sh"]
|
start.sh
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Start FastAPI
|
4 |
+
uvicorn app:app --host 0.0.0.0 --port 8501 &
|
5 |
+
|
6 |
+
# Start Streamlit
|
7 |
+
streamlit run streamlit_app.py --server.port=8502 --server.address=0.0.0.0
|