Update Dockerfile
Browse files- Dockerfile +18 -18
Dockerfile
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
# Use
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
#
|
5 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
-
|
|
|
|
|
7 |
|
8 |
-
#
|
|
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
# Install
|
12 |
-
RUN apt-get update && apt-get install -y \
|
13 |
build-essential \
|
14 |
libglib2.0-0 \
|
15 |
libsm6 \
|
16 |
libxext6 \
|
17 |
libxrender-dev \
|
18 |
-
|
19 |
-
|
20 |
-
# Copy requirements first to leverage Docker cache
|
21 |
-
COPY requirements.txt .
|
22 |
|
23 |
# Install Python dependencies
|
24 |
-
|
|
|
25 |
|
26 |
-
# Copy
|
27 |
COPY . .
|
28 |
|
29 |
-
# Expose ports
|
30 |
-
EXPOSE 8501
|
31 |
-
EXPOSE 8000
|
32 |
|
33 |
-
#
|
34 |
-
CMD ["sh", "-c", "streamlit run app.py & uvicorn api:app --host 0.0.0.0 --port 8000"]
|
|
|
1 |
+
# Use official slim Python base image
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
+
# Environment settings
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
6 |
+
PYTHONUNBUFFERED=1 \
|
7 |
+
TRANSFORMERS_CACHE=/tmp/huggingface \
|
8 |
+
HF_HOME=/tmp/huggingface
|
9 |
|
10 |
+
# Create cache and working directories
|
11 |
+
RUN mkdir -p /tmp/huggingface /app/data /app/vectorstore
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# Install OS dependencies
|
15 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
16 |
build-essential \
|
17 |
libglib2.0-0 \
|
18 |
libsm6 \
|
19 |
libxext6 \
|
20 |
libxrender-dev \
|
21 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
22 |
|
23 |
# Install Python dependencies
|
24 |
+
COPY requirements.txt .
|
25 |
+
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
26 |
|
27 |
+
# Copy application code
|
28 |
COPY . .
|
29 |
|
30 |
+
# Expose ports for Streamlit and FastAPI
|
31 |
+
EXPOSE 8501 8000
|
|
|
32 |
|
33 |
+
# Run both Streamlit and FastAPI
|
34 |
+
CMD ["sh", "-c", "streamlit run app.py & exec uvicorn api:app --host 0.0.0.0 --port 8000"]
|