Update Dockerfile
Browse files- Dockerfile +27 -6
Dockerfile
CHANGED
|
@@ -1,8 +1,29 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.10 as the base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app/src
|
| 6 |
|
| 7 |
+
# Copy the `requirements.txt` file from `src` directory
|
| 8 |
+
COPY src/requirements.txt ./requirements.txt
|
| 9 |
+
|
| 10 |
+
# Install Python dependencies
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Copy the entire `src` directory to the container
|
| 14 |
+
COPY src .
|
| 15 |
+
|
| 16 |
+
# Expose ports for the FastAPI and Streamlit apps
|
| 17 |
+
EXPOSE 8000 8501
|
| 18 |
+
|
| 19 |
+
# Create a script to run both the FastAPI and Streamlit apps
|
| 20 |
+
RUN echo '#!/bin/bash\n\
|
| 21 |
+
python response_api.py &\n\
|
| 22 |
+
sleep 5\n\
|
| 23 |
+
streamlit run app.py' > ./start.sh
|
| 24 |
+
|
| 25 |
+
# Make the script executable
|
| 26 |
+
RUN chmod +x ./start.sh
|
| 27 |
+
|
| 28 |
+
# Run the startup script
|
| 29 |
+
CMD ["./start.sh"]
|