2023-02-23 14:08:34 +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}"
|
|
|
|
RUN pip install --upgrade pip && pip install tiktoken==0.1.2
|
|
|
|
|
|
|
|
FROM python:3.11-slim-bullseye
|
|
|
|
# Copy pre-built packages from builder stage
|
|
|
|
COPY --from=builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
|
2023-02-03 12:45:29 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY . /app
|
|
|
|
ENV FLASK_APP=app.py
|
|
|
|
ENV FLASK_ENV=development
|
2023-02-23 14:08:34 +00:00
|
|
|
RUN pip install -r requirements.txt
|
2023-02-03 12:45:29 +00:00
|
|
|
|
|
|
|
EXPOSE 5000
|
|
|
|
|
|
|
|
CMD ["flask", "run", "--host=0.0.0.0"]
|