-
Notifications
You must be signed in to change notification settings - Fork 20
Add auth and docker documentation #348
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
Open
milindl
wants to merge
1
commit into
master
Choose a base branch
from
dev_doc_updates
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,30 +1,37 @@ | ||
When using docker to install `confluent-kafka-javascript`, you need to make sure you install appropriate library dependencies. Alpine linux is a lighter weight version of linux and does not come with the same base libraries as other distributions (like glibc). | ||
# Dockerfile for confluent-kafka-javascript | ||
|
||
You can see some of the differences here: https://linuxacademy.com/blog/cloud/alpine-linux-and-docker/ | ||
A sample Dockerfile to run the `confluent-kafka-javascript` library using Node.js: | ||
|
||
```dockerfile | ||
FROM node:14-alpine | ||
|
||
RUN apk --no-cache add \ | ||
bash \ | ||
g++ \ | ||
ca-certificates \ | ||
lz4-dev \ | ||
musl-dev \ | ||
cyrus-sasl-dev \ | ||
openssl-dev \ | ||
make \ | ||
python3 | ||
|
||
RUN apk add --no-cache --virtual .build-deps gcc zlib-dev libc-dev bsd-compat-headers py-setuptools bash | ||
# The official (Debian-based) and Alpine-based Node.js images are both useable. | ||
FROM node:24 | ||
|
||
# Create app directory | ||
RUN mkdir -p /usr/local/app | ||
|
||
# Move to the app directory | ||
WORKDIR /usr/local/app | ||
|
||
# Install confluent-kafka-javascript | ||
RUN npm install confluent-kafka-javascript | ||
# Copy package.json first to check if an npm install is needed | ||
# Copy relevant files | ||
COPY . . | ||
|
||
# Install application dependencies, if node_modules is not already present. | ||
RUN npm install | ||
|
||
# Rebuild the @confluentinc/kafka-javascript package for this environment. See | ||
# below for more details on why this is necessary, and if you can skip this step. | ||
RUN rm -rf node_modules/@confluentinc/kafka-javascript | ||
RUN npm install @confluentinc/kafka-javascript | ||
|
||
# Start application | ||
CMD ["node", "index.js"] | ||
``` | ||
|
||
`confluent-kafka-javascript` contains platform specific binary code (to talk to the underlying C library). | ||
Depending on the OS, platform, architecture, and the libc type (glibc or musl), a different binary is required. | ||
|
||
The correct binary is downloaded from GitHub when installing the package for the first time, however, if you copy | ||
the `node_modules` directory from a different environment (e.g., your local machine) into the Docker container, it may not work correctly due to platform differences. | ||
|
||
If you can ensure that the `node_modules` directory is not copied into the Docker container, or that the platform | ||
where the image is built is identical to the Docker container's platform, you can skip the reinstallation step. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comma after 'authentication'. Should be: 'For a special case of OAuthBearer token authentication, where the token is fetched from an OIDC provider using the
client_credentials
orjwt_bearer
grant type, the library provides a built-in mechanism for authentication.'Copilot uses AI. Check for mistakes.