-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
feat: add Docker Compose support and update documentation #3554
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces Docker Compose support for the project by adding a new Changes
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant Docker as Docker Compose
participant App as Application Container
Dev->>Docker: docker-compose up
Docker->>App: Build and start container
Docker->>App: Mount local code volumes
App-->>Dev: Development server running on localhost:3000
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docker-compose.yml (1)
3-15
: Consider adding container management configurations.The service configuration looks good with proper build context, port mapping, volume mounts for hot reloading, and environment settings. However, consider adding the following configurations to improve container management:
services: app: + container_name: asyncapi-website # For easier container identification build: context: . dockerfile: Dockerfile # Path to Dockerfile ports: - "3000:3000" # Map host port 3000 to container port 3000 volumes: - .:/async # Mount the current directory to /async in the container - for hot reloading - /async/node_modules # Exclude node_modules from being overridden environment: NODE_ENV: development # it Set environment variable command: ["npm", "run", "dev"] + restart: unless-stopped # Automatic container recovery + healthcheck: # Container health monitoring + test: ["CMD", "wget", "--spider", "-q", "localhost:3000"] + interval: 30s + timeout: 10s + retries: 3README.md (1)
137-164
: Documentation improvements needed.The Docker Compose documentation is well-structured with clear prerequisites, steps, and features. However, there are a few improvements needed:
- Remove duplicate "Install" word in prerequisites:
#### Prerequisites: -- [Install Docker](https://docs.docker.com/get-docker/) -- [Install Docker Compose](https://docs.docker.com/compose/install/) ++ [Docker](https://docs.docker.com/get-docker/) ++ [Docker Compose](https://docs.docker.com/compose/install/)
- Remove trailing colons from headings to comply with markdown standards:
-### Run locally using Docker Compose: +### Run locally using Docker Compose -#### Prerequisites: +#### Prerequisites -#### Steps: +#### Steps -#### Features: +#### Features
- Add periods at the end of sentences for consistency:
-The `docker-compose.yml` file automatically sets up the container and maps your local code to the container's `/async` directory +The `docker-compose.yml` file automatically sets up the container and maps your local code to the container's `/async` directory.🧰 Tools
🪛 LanguageTool
[grammar] ~141-~141: This phrase is duplicated. You should probably use “Install Docker” only once.
Context: ...Docker Compose #### Prerequisites: - Install Docker - [Install Docker Compose](https://docs.docker.com/compos...(PHRASE_REPETITION)
🪛 Markdownlint (0.37.0)
139-139: Punctuation: ':'
Trailing punctuation in heading(MD026, no-trailing-punctuation)
146-146: Punctuation: ':'
Trailing punctuation in heading(MD026, no-trailing-punctuation)
155-155: Punctuation: ':'
Trailing punctuation in heading(MD026, no-trailing-punctuation)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.md
(1 hunks)docker-compose.yml
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[grammar] ~141-~141: This phrase is duplicated. You should probably use “Install Docker” only once.
Context: ...Docker Compose #### Prerequisites: - Install Docker - [Install Docker Compose](https://docs.docker.com/compos...
(PHRASE_REPETITION)
🪛 Markdownlint (0.37.0)
README.md
139-139: Punctuation: ':'
Trailing punctuation in heading
(MD026, no-trailing-punctuation)
146-146: Punctuation: ':'
Trailing punctuation in heading
(MD026, no-trailing-punctuation)
155-155: Punctuation: ':'
Trailing punctuation in heading
(MD026, no-trailing-punctuation)
⏰ Context from checks skipped due to timeout of 180000ms (1)
- GitHub Check: Lighthouse CI
🔇 Additional comments (1)
docker-compose.yml (1)
1-2
: LGTM! Version specification is appropriate.Using version '3.8' of the Docker Compose format is a good choice as it provides modern features while maintaining compatibility.
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-3554--asyncapi-website.netlify.app/ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3554 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 19
Lines 668 668
=========================================
Hits 668 668 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (4)
docker-compose.yml (3)
6-8
: Remove redundant comment.The comment
# Path to Dockerfile
is redundant as the field namedockerfile
is self-explanatory.build: context: . - dockerfile: Dockerfile # Path to Dockerfile + dockerfile: Dockerfile
9-10
: Improve comment formatting.The comment is redundant and inconsistently aligned with other comments.
ports: - - "3000:3000" # Map host port 3000 to container port 3000 + - "3000:3000"
11-13
: Consider using a more standard container path.The path
/async
is non-standard. Consider using/app
or/usr/src/app
which are more commonly used in Node.js containers.volumes: - - .:/async # Mount the current directory to /async in the container - for hot reloading - - /async/node_modules # Exclude node_modules from being overridden + - .:/usr/src/app # Mount for hot reloading + - /usr/src/app/node_modules # Exclude node_modules from being overriddenREADME.md (1)
139-142
: Remove duplicate Docker prerequisite.Docker is listed twice in the prerequisites section since it's already included in Docker Compose installation requirements.
#### Prerequisites - [Docker](https://docs.docker.com/get-docker/) - [Docker Compose](https://docs.docker.com/compose/install/)🧰 Tools
🪛 LanguageTool
[duplication] ~141-~141: Possible typo: you repeated a word
Context: ... Docker Compose #### Prerequisites - Docker - [Docker Compose](https://docs.docker.com/compos...(ENGLISH_WORD_REPEAT_RULE)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.md
(1 hunks)docker-compose.yml
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[duplication] ~141-~141: Possible typo: you repeated a word
Context: ... Docker Compose #### Prerequisites - Docker - [Docker Compose](https://docs.docker.com/compos...
(ENGLISH_WORD_REPEAT_RULE)
🔇 Additional comments (4)
docker-compose.yml (3)
1-5
: LGTM! Version and service naming are appropriate.The Docker Compose version and service naming follow best practices:
- Version 3.8 is suitable for modern Docker installations.
- Container name is descriptive and matches the project.
14-15
: LGTM! Environment configuration is appropriate.The NODE_ENV setting is correctly configured for development.
16-17
: LGTM! Command and restart policy are well configured.The development command and container recovery settings are appropriate:
- Uses npm run dev for development server
- Restart policy ensures container stays up during development
README.md (1)
146-163
: LGTM! Documentation is clear and informative.The steps and features sections are well-structured:
- Clear instructions for starting and stopping the environment
- Good explanation of Docker Compose benefits
- Helpful details about volume mounting and isolation
docker-compose.yml
Outdated
healthcheck: # Container health monitoring | ||
test: ["CMD", "wget", "--spider", "-q", "localhost:3000"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 |
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.
🛠️ Refactor suggestion
Use curl instead of wget for health check.
The wget command might not be available in the Node.js base image. Consider using curl which is more commonly available.
healthcheck:
- test: ["CMD", "wget", "--spider", "-q", "localhost:3000"]
+ test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
healthcheck: # Container health monitoring | |
test: ["CMD", "wget", "--spider", "-q", "localhost:3000"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 | |
healthcheck: # Container health monitoring | |
test: ["CMD", "curl", "-f", "http://localhost:3000"] | |
interval: 30s | |
timeout: 10s | |
retries: 3 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docker-compose.yml (2)
9-10
: Consider using environment variables for port configuration.While the direct port mapping is fine for development, consider making it configurable through environment variables for better flexibility.
ports: - - "3000:3000" + - "${PORT:-3000}:3000"
11-13
: Consider using a more conventional mount path.While the volume configuration correctly handles node_modules, the mount path
/async
is unconventional. Consider using/app
or/usr/src/app
which are more commonly used in Node.js containers.volumes: - - .:/async - - /async/node_modules + - .:/app + - /app/node_modules
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docker-compose.yml
(1 hunks)
🔇 Additional comments (4)
docker-compose.yml (4)
1-5
: LGTM! Good choice of version and naming.The Compose file version 3.8 is appropriate, and the container naming is clear and descriptive.
14-16
: LGTM! Appropriate development configuration.The environment variable and startup command are well-configured for development purposes.
17-22
: LGTM! Well-configured container management.The restart policy and healthcheck configuration are appropriate. The use of curl for healthcheck is correct, as previously suggested.
6-8
: Verify Dockerfile existence and compatibility.The configuration references a Dockerfile in the root directory.
Let's verify the Dockerfile exists and check its content:
✅ Verification successful
Dockerfile verification successful
The referenced Dockerfile exists in the root directory and contains valid Node.js development configuration.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if Dockerfile exists and examine its content if [ -f "Dockerfile" ]; then echo "Dockerfile exists. Content:" cat Dockerfile else echo "Error: Dockerfile not found in root directory" exit 1 fiLength of output: 476
Linked Issue: Closes #3542
This PR adds a
docker-compose.yml
file to simplify the development setup and updates the README with instructions on using Docker Compose.Summary by CodeRabbit
Documentation
Chores
docker-compose.yml
to streamline local development process.