-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Updating pinecone client to use serverless-index, adding best …
…Dockerfile practices. Adding example .env
- Loading branch information
Showing
6 changed files
with
370 additions
and
1,163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#---------------------------------------------------------------------------- | ||
# OpenAI | ||
#---------------------------------------------------------------------------- | ||
OPENAI_TOKEN=your-api-key # Replace your-api-key with your personal API key | ||
|
||
#---------------------------------------------------------------------------- | ||
# Pinecone | ||
#---------------------------------------------------------------------------- | ||
PINECONE_TOKEN=your-api-key # Replace your-api-key with your personal API key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,53 @@ | ||
FROM python:3.11-bullseye | ||
# syntax=docker/dockerfile:1 | ||
|
||
WORKDIR /usr/src/app | ||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
COPY docker_bot /usr/src/app/docker_bot | ||
COPY pyproject.toml /usr/src/app/pyproject.toml | ||
COPY README.md /usr/src/app/README.md | ||
ARG PYTHON_VERSION=3.11 | ||
FROM python:${PYTHON_VERSION}-slim as base | ||
|
||
RUN pip install -e . | ||
# Prevents Python from writing pyc files. | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Keeps Python from buffering stdout and stderr to avoid situations where | ||
# the application crashes without emitting any logs due to buffering. | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /app | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
appuser | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds. | ||
# Leverage a bind mount to pyproject.toml to avoid having to copy them into | ||
# into this layer. | ||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
--mount=type=bind,source=poetry.lock,target=poetry.lock \ | ||
--mount=type=bind,source=docker_bot,target=docker_bot \ | ||
--mount=type=bind,source=README.md,target=README.md \ | ||
python -m pip install . | ||
|
||
# Switch to the non-privileged user to run the application. | ||
USER appuser | ||
|
||
# Copy the source code into the container. | ||
COPY . . | ||
|
||
# Expose the port that the application listens on. | ||
EXPOSE 8504 | ||
|
||
HEALTHCHECK CMD curl --fail http://localhost:8504/_stcore/health | ||
|
||
ENTRYPOINT ["streamlit", "run", "docker_bot/bot.py", "--server.port=8504", "--server.address=0.0.0.0"] | ||
# Run the application. | ||
CMD streamlit run docker_bot/bot.py --server.port=8504 --server.address=0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.