-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
35 lines (26 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use the official lightweight Python image as a base
FROM python:3.11-slim as app
# Install necessary packages and clean up to reduce image size
RUN apt-get update && apt-get install -y --no-install-recommends \
curl && \
rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the large 'chroma' folder first to maximize caching
COPY /application/docs/chroma /app/docs/chroma
# Set permissions for the chroma directory (if necessary)
RUN chown -R root:root /app/docs/chroma && \
chmod -R 755 /app/docs/chroma
# Copy only requirements files first to optimize layer caching
COPY /application/requirements.txt /app/
COPY /application/requirements_full.txt /app/
# Install dependencies, using no-cache to avoid cache bloating
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir -r requirements_full.txt
# Copy the rest of the application code last to avoid invalidating cache during code changes
COPY /application/ /app/
# Expose the application's port
EXPOSE 8000
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]