Create Dockerfile
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.10-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 system dependencies
|
11 |
+
RUN apt-get update && apt-get install -y \
|
12 |
+
build-essential \
|
13 |
+
curl \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
+
|
16 |
+
# Install Python dependencies
|
17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
+
|
19 |
+
# Expose ports for FastAPI and Streamlit
|
20 |
+
EXPOSE 8000
|
21 |
+
EXPOSE 7860
|
22 |
+
|
23 |
+
# Create a script to run both FastAPI and Streamlit
|
24 |
+
RUN echo '#!/bin/bash\n\
|
25 |
+
uvicorn backend:app --host 0.0.0.0 --port 8000 &\n\
|
26 |
+
streamlit run frontend.py --server.port 7860 --server.address 0.0.0.0\n\
|
27 |
+
' > /app/run.sh
|
28 |
+
|
29 |
+
# Make the script executable
|
30 |
+
RUN chmod +x /app/run.sh
|
31 |
+
|
32 |
+
# Run the script when the container launches
|
33 |
+
CMD ["/app/run.sh"]
|