-
Notifications
You must be signed in to change notification settings - Fork 0
add docker & api route #113
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
Conversation
PR Review ❌ Documentation drift: Inconsistent port settings between Dockerfile (8080) and appConfig.js (80) needs updating. Generated by Firstmate to make sure you can focus on coding new features. |
| 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"] No newline at end of file |
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, while the default server port in appConfig.js has been changed to 80. This inconsistency should be addressed in the documentation to ensure users know which port to use when starting the application. Consider updating the documentation to clarify the expected port settings. For example:
## Running the Application
To start the application, use the following command:
```bash
docker run -p 8080:8080 your-image-nameBy default, the application will run on port 80 unless specified otherwise.
| router.route("/get/:id").get(exampleController.getById) | ||
|
|
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.
The route '/get/:id' is missing the grantAccessByPermissionMiddleware, which is essential for proper permission checks. Update the route definition to include this middleware as follows:
+ router.route("/get/:id").get(grantAccessByPermissionMiddleware([API_PERMISSIONS.PUBLIC_ENDPOINT]), exampleController.getById)This ensures that access permissions are validated before executing the controller logic.
(Based on guideline 'Routes should check permissions')
| 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"] No newline at end of file |
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.
Consider using multi-stage builds in your Dockerfile to optimize the image size and build efficiency by separating the build environment from the runtime environment. Here's a simplified example based on your current Dockerfile:
FROM node:19-alpine AS build
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
FROM node:19-alpine
WORKDIR /usr/src/app
COPY --from=build /usr/src/app ./
EXPOSE 8080
CMD ["npm", "start", "--no-update-notifier"]
(Based on guideline 'Dockerfiles should use multi-stage builds')
|
I analysed the failed pipeline job Failure AnalysisThe pipeline crashed during the Docker build step, specifically when executing the command to install This suggests that the Suggested FixTo resolve the permission issue, you can modify the Dockerfile to switch to the root user before running the - USER appuser
+ USER root
RUN apk add --no-cache git
+ USER appuserThis change allows the installation of |
|
I analysed the failed pipeline job Failure AnalysisThe pipeline crashed during the Docker build step, specifically when trying to install This error suggests that the Dockerfile is attempting to run the Suggested FixTo resolve the permission issue, you can modify the Dockerfile to switch to the root user before running the - USER appuser
+ USER root
RUN apk add --no-cache git
+ USER appuserThis change allows the |



💡 PR Summary generated by FirstMate
Overview: Added Docker support and a new API route for enhanced functionality.
Changes:
Dockerfile:
API Route Update:
/get/:idinexampleRouter.jsfor fetching data by ID.Configuration Change:
appConfig.jsto default server port to 80 instead of 8080.TLDR: Introduced Docker support and a new API route for data retrieval; updated server port configuration. Focus on the Dockerfile and new route in
exampleRouter.js.Generated by FirstMate and automatically updated on every commit.