-
Notifications
You must be signed in to change notification settings - Fork 0
add docker & api route #118
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM node:19-alpine | ||
ENV PORT 8080 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
USER appuser | ||
|
||
RUN apk add --no-cache git | ||
COPY . . | ||
EXPOSE 8080 | ||
CMD ["npm", "start", "--no-update-notifier"] | ||
Comment on lines
+1
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your Dockerfile does not implement multi-stage builds, which can significantly reduce the final image size and separate build dependencies from runtime dependencies. Consider restructuring it like this:
This approach will optimize your image size and improve build efficiency. (Based on guideline 'Dockerfiles should use multi-stage builds')
Comment on lines
+2
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You changed the application to run on port 8080 in the Dockerfile. Additionally, the default server port in ## Running the Application
To start the application, use the following command:
```bash
docker run -p 8080:8080 your-image-name The application will run on port 8080 by default. If you are running the application directly, it will now default to port 80.
Comment on lines
+1
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Dockerfile does not utilize multi-stage builds, which can significantly reduce the final image size and improve build efficiency. Restructure it to include a build stage and a final stage like this:
This approach will help streamline your image creation process. (Based on guideline 'Dockerfiles should use multi-stage builds') |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,7 @@ const router = express.Router(); | |
router.route("/:id") | ||
.get(grantAccessByPermissionMiddleware([API_PERMISSIONS.PUBLIC_ENDPOINT]), exampleController.getById) | ||
|
||
router.route("/get/:id").get(exampleController.getById) | ||
|
||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The newly added route '/get/:id' does not implement the router.route("/get/:id").get(grantAccessByPermissionMiddleware([API_PERMISSIONS.PUBLIC_ENDPOINT]), exampleController.getById); This ensures compliance with the security guidelines. (Based on guideline 'Routes should check permissions')
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new route '/get/:id' does not use the + router.route("/get/:id").get(grantAccessByPermissionMiddleware([API_PERMISSIONS.PUBLIC_ENDPOINT]), exampleController.getById) (Based on guideline 'Check permissions with middleware') |
||
|
||
export default router; |
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.
You changed the application to run on port 8080 in the Dockerfile. Additionally, the default server port in
appConfig.js
has been changed to 80. This change seems important, so it might be smart to update the documentation accordingly. Make sure to specify the correct port for running the application.Example documentation update:
The application will be accessible at
http://localhost:8080
.