-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathDockerfile
49 lines (30 loc) · 1.2 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
36
37
38
39
40
41
42
43
44
45
46
47
48
# Dockerfile is based on the following tutorial:
# https://www.erraticbits.ca/post/2021/fastapi/
# Build step #1: build the React front end
FROM node:20-bookworm-slim as build-step
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY frontend/package.json ./
RUN npm install
COPY ./frontend/ ./
RUN npm run build
FROM python:3.11-slim-bookworm
RUN apt-get update -y && apt-get install -y gcc && rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install poetry for packages management
RUN python -m pip install -U pip poetry
RUN poetry config virtualenvs.create false
# Use /app as the working directory
WORKDIR /app
# Copy poetry files & install the dependencies
COPY ./pyproject.toml /app
COPY ./poetry.lock /app
COPY --from=build-step /app/dist /app/static
RUN poetry install --no-interaction --no-ansi --no-root --without dev
RUN python -c 'from fastembed.embedding import DefaultEmbedding; DefaultEmbedding("sentence-transformers/all-MiniLM-L6-v2")'
# Finally copy the application source code and install root
COPY qdrant_demo /app/qdrant_demo
EXPOSE 8000
CMD uvicorn qdrant_demo.service:app --host 0.0.0.0 --port 8000 --workers ${WORKERS:-1}