2023-12-22 13:25:57 +00:00
|
|
|
FROM python:3.11-slim-bullseye as builder
|
2023-02-03 12:45:29 +00:00
|
|
|
|
2023-02-23 14:08:34 +00:00
|
|
|
# Tiktoken requires Rust toolchain, so build it in a separate stage
|
|
|
|
RUN apt-get update && apt-get install -y gcc curl
|
|
|
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && apt-get install --reinstall libc6-dev -y
|
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
2023-12-22 13:25:57 +00:00
|
|
|
RUN pip install --upgrade pip && pip install tiktoken==0.5.2
|
2023-03-06 18:34:48 +00:00
|
|
|
COPY requirements.txt .
|
|
|
|
RUN pip install -r requirements.txt
|
2024-01-09 11:39:32 +00:00
|
|
|
RUN apt-get install -y wget unzip
|
2024-01-09 11:41:25 +00:00
|
|
|
RUN wget https://d3dg1063dc54p9.cloudfront.net/models/embeddings/mpnet-base-v2.zip
|
2024-01-09 11:39:32 +00:00
|
|
|
RUN unzip mpnet-base-v2.zip -d model
|
|
|
|
RUN rm mpnet-base-v2.zip
|
2023-03-06 18:34:48 +00:00
|
|
|
|
2023-12-22 13:25:57 +00:00
|
|
|
FROM python:3.11-slim-bullseye
|
2023-06-15 16:40:58 +00:00
|
|
|
|
|
|
|
# Copy pre-built packages and binaries from builder stage
|
|
|
|
COPY --from=builder /usr/local/ /usr/local/
|
|
|
|
|
2023-02-03 12:45:29 +00:00
|
|
|
WORKDIR /app
|
2024-01-09 11:39:32 +00:00
|
|
|
COPY --from=builder /model /app/model
|
|
|
|
|
2023-08-13 19:00:52 +00:00
|
|
|
COPY . /app/application
|
2023-02-03 12:45:29 +00:00
|
|
|
ENV FLASK_APP=app.py
|
2023-02-25 19:20:09 +00:00
|
|
|
ENV FLASK_DEBUG=true
|
2023-03-14 14:29:36 +00:00
|
|
|
|
2023-06-23 11:56:14 +00:00
|
|
|
EXPOSE 7091
|
2023-02-03 12:45:29 +00:00
|
|
|
|
2023-08-13 19:00:52 +00:00
|
|
|
CMD ["gunicorn", "-w", "2", "--timeout", "120", "--bind", "0.0.0.0:7091", "application.wsgi:app"]
|