Chmod first - #47
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the Dockerfile by consolidating the setup of the start.sh startup script into a single COPY command with built-in permission settings, eliminating redundant operations.
Key changes:
- Consolidated script copying and permission setting into one
COPY --chmod=755instruction - Removed duplicate
COPY --chownandRUN chmod +xcommands - Moved the script setup earlier in the Dockerfile (before USER switch)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| chown -R worker:nodejs /home/worker | ||
|
|
||
| # Copy and setup start script with proper permissions and ownership | ||
| COPY --chmod=755 --chown=worker:nodejs start.sh /app/start.sh |
There was a problem hiding this comment.
The script is copied with permissions 755 before switching to the non-root user. If the start.sh file contains sensitive information or credentials, this could allow other users on the system to read it. Consider using more restrictive permissions like 750 or 700 to limit access to the owner and group only.
| COPY --chmod=755 --chown=worker:nodejs start.sh /app/start.sh | |
| COPY --chmod=700 --chown=worker:nodejs start.sh /app/start.sh |
Fixes #14
This pull request updates the Dockerfile to streamline the setup and permissions of the
start.shstartup script. The changes simplify the process by using Docker's built-in features for file permissions and remove redundant commands.Improvements to Dockerfile setup and permissions:
chmodandchowncommands forstart.shwith a singleCOPY --chmod=755instruction, ensuring the script has execute permissions immediately upon copying.COPY --chownandRUN chmod +xlines forstart.sh, relying on the updatedCOPYcommand for both placement and permissions.Entrypoint configuration: