-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (22 loc) · 819 Bytes
/
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
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Install Poetry and other dependencies
RUN pip install --upgrade pip --no-cache-dir && \
pip install poetry --no-cache-dir
# Update the package lists, install make
RUN apt-get update && apt-get install -y make
# Set the working directory in the container
WORKDIR /app
# Copy only the dependency files first to leverage caching
COPY pyproject.toml poetry.lock ./
# Install only production dependencies using Poetry
RUN poetry install
# Copy the rest of the application code
COPY . .
RUN poetry install --only-root
# Download images and create vector database
RUN make create-database
# Expose the port for FastAPI
EXPOSE 8000
# Set the entrypoint to run the API directly
CMD ["poetry", "run", "fastapi", "run", "scripts/api/app.py"]