-
Notifications
You must be signed in to change notification settings - Fork 0
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
add docker & api route #124
Conversation
PR Review ❌ Documentation drift: Update documentation for default server port change from 8080 to 80. Generated by Firstmate to make sure you can focus on coding new features. |
return process.env.PORT || 80; | ||
} |
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 default server port from 8080 to 80. This change seems important, so it might be smart to change the documentation accordingly. Update the documentation to reflect the new default port.
For example:
## Running the Application
To start the application, use:
```bash
npm start
The application will now run on port 80 by default.
FROM node:19-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
USER appuser | ||
|
||
RUN apk add --no-cache git | ||
COPY . . | ||
CMD ["npm", "start", "--no-update-notifier"] |
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.
Your Dockerfile should implement multi-stage builds to optimize image size and improve build performance. Consider using a builder stage to install dependencies and build the application, then copy the necessary files to a smaller runtime image. Here's an example:
# Builder stage
FROM node:19-alpine AS builder
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM node:19-alpine
WORKDIR /usr/src/app
COPY --from=builder /usr/src/app/dist ./
CMD ["npm", "start", "--no-update-notifier"]
(Based on guideline 'Dockerfiles should use multi-stage builds')
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)
(Based on guideline 'Routes should check permissions')
I analysed the failed pipeline job Failure AnalysisThe pipeline crashed during the Docker build step, specifically when trying to execute the command
This suggests that the Dockerfile is attempting to install packages as a non-root user ( Suggested FixTo resolve the permission issue, you can modify the Dockerfile to switch to the root user before running the package installation command and then switch back to the non-root user afterward. Here’s how you can adjust the Dockerfile: - USER appuser
+ USER root
RUN apk add --no-cache git
+ USER appuser This change ensures that the |
💡 PR Summary generated by FirstMate
Overview: Added Docker support and a new API route for fetching examples by ID.
Changes:
Dockerfile:
API Route Update:
/get/:id
inexampleRouter.js
for fetching example data.Configuration Change:
appConfig.js
from 8080 to 80 for consistency.TLDR: Introduced Docker support and a new API route for fetching examples, while updating the server port configuration. Review the Dockerfile and
exampleRouter.js
for key changes.Generated by FirstMate and automatically updated on every commit.