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

feat: dockerize api #79

Merged
merged 6 commits into from
Jan 14, 2024
Merged

feat: dockerize api #79

merged 6 commits into from
Jan 14, 2024

Conversation

ezhil56x
Copy link
Contributor

@ezhil56x ezhil56x commented Jan 14, 2024

Description

  • Added Dockerfile to apps/api
  • Moved Dockerfile-web to apps/web as Dockerfile

Fixes #29

Future Improvements

  • As Dockerfile-web to apps/web as Dockerfile, some change are to be made on workflows
  • start:api should be added to package.json

Mentions

@rajdip-b

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

@codiumai-pr-agent-free codiumai-pr-agent-free bot added the type: enhancement New feature or request label Jan 14, 2024
Copy link
Contributor

PR Description updated to latest commit (6b756e8)

Copy link
Contributor

codiumai-pr-agent-free bot commented Jan 14, 2024

PR Analysis

(review updated until commit 265cec0)

  • 🎯 Main theme: Dockerizing the API and Web applications
  • 📝 PR summary: This PR aims to dockerize the API and Web applications by adding Dockerfile to each of them. It also includes the addition of .dockerignore files to ignore node_modules/ during the docker build process.
  • 📌 Type of PR: Enhancement
  • 🧪 Relevant tests added: No
  • ⏱️ Estimated effort to review [1-5]: 2, because the PR is straightforward and involves Dockerization of the applications which is a common task. However, it lacks tests to ensure the Dockerized applications work as expected.
  • 🔒 Security concerns: No

PR Feedback

💡 General suggestions: It's good to see that the applications are being dockerized, which will help in easier deployment and scaling. However, it would be beneficial to include tests to ensure the Dockerized applications work as expected. Also, consider removing the commented environment variables from the Dockerfile and manage them using Docker Compose or Kubernetes for better security and management.

🤖 Code feedback:
relevant fileapps/api/Dockerfile
suggestion      

Consider using multi-stage builds to reduce the size of the final Docker image. This can be done by using a separate build stage to compile the application and then copying the compiled application into a new stage with a smaller base image. [important]

relevant lineFROM node:20-alpine as build

relevant fileapps/api/Dockerfile
suggestion      

Avoid using RUN pnpm install without a lockfile. This can lead to non-deterministic builds, as pnpm install will fetch the latest versions of dependencies. Instead, commit your pnpm-lock.yaml file and use RUN pnpm install --frozen-lockfile for deterministic builds. [important]

relevant lineRUN pnpm install


✨ Usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...

With a configuration file, use the following template:

[pr_reviewer]
some_config1=...
some_config2=...
Utilizing extra instructions

The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

Examples for extra instructions:

[pr_reviewer] # /review #
extra_instructions="""
In the code feedback section, emphasize the following:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

How to enable\disable automation
  • When you first install PR-Agent app, the default mode for the review tool is:
pr_commands = ["/review", ...]

meaning the review tool will run automatically on every PR, with the default configuration.
Edit this field to enable/disable the tool, or to change the used configurations

About the 'Code feedback' section

The review tool provides several type of feedbacks, one of them is code suggestions.
If you are interested only in the code suggestions, it is recommended to use the improve feature instead, since it dedicated only to code suggestions, and usually gives better results.
Use the review tool if you want to get a more comprehensive feedback, which includes code suggestions as well.

Auto-labels

The review tool can auto-generate two specific types of labels for a PR:

  • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
  • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
Extra sub-tools

The review tool provides a collection of possible feedbacks about a PR.
It is recommended to review the possible options, and choose the ones relevant for your use case.
Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
require_score_review, require_soc2_review, enable_review_labels_effort, and more.

More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the review usage page for a comprehensive guide on using this tool.

Copy link
Member

@rajdip-b rajdip-b left a comment

Choose a reason for hiding this comment

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

Additionally, do add a .dockerignore file in both web and api. for now just add node_modules in that file. Later on, we can add more stuff when needed

apps/api/Dockerfile Show resolved Hide resolved
Copy link
Member

@rajdip-b rajdip-b left a comment

Choose a reason for hiding this comment

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

Just make the update to web.yaml workflow, and this PR should be good to go!

@rajdip-b
Copy link
Member

/review

Copy link
Contributor

Persistent review updated to latest commit 265cec0

@ezhil56x
Copy link
Contributor Author

Just make the update to web.yaml workflow, and this PR should be good to go!

Done 👍🏻

@rajdip-b
Copy link
Member

Made some changes to the final PR:

  • remove the comments from Dockerfile. Guess we wont need them afterall, sorry for bothering you with that
  • Add the start:api script in package.json

@ezhil56x

Copy link
Member

@rajdip-b rajdip-b left a comment

Choose a reason for hiding this comment

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

All looks good now!

@rajdip-b rajdip-b merged commit dfbc58e into keyshade-xyz:main Jan 14, 2024
6 checks passed
@rajdip-b
Copy link
Member

rajdip-b commented Feb 2, 2024

🎉 This PR is included in version 1.0.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@rajdip-b
Copy link
Member

rajdip-b commented Feb 9, 2024

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Dockerfile for API
2 participants