Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: dockerize manual instrumentation example #2797

Merged
merged 9 commits into from
Apr 8, 2024

Conversation

axiomofjoy
Copy link
Contributor

@axiomofjoy axiomofjoy commented Apr 6, 2024

Dockerizes manual instrumentation example so someone can spin it up and try it out in a single command.

resolves #2798

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 6, 2024
Copy link
Contributor

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

FROM python:3.11-slim as builder
WORKDIR /app
COPY requirements.txt /app/
RUN pip install uv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually speed up things??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv is definitely faster, although the reason I chose it here is to use uv pip sync, which guarantees that we are installing the exact versions of the packages pinned in requirements.txt. pip install does not provide any guarantees here.

ruff check --fix . && ruff format .

typecheck:
pyright .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda curious why you chose pyright here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbitrary choice. I can switch to mypy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pyright is faster, though.

docker build -t chat-service .

docker-run:
docker run -e "OPENAI_API_KEY=$OPENAI_API_KEY" -p 8000:8000 -it chat-service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the env variable get mounted anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, I don't believe it does.

get_openapi(
title="Chat Service Schema",
version="1.0.0",
description="Your API Description",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should fill this out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 8752d4f

@axiomofjoy axiomofjoy merged commit 651efbe into main Apr 8, 2024
5 checks passed
@axiomofjoy axiomofjoy deleted the manual-instrumentation-docker branch April 8, 2024 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] containerize manual instrumentation example
2 participants