Skip to content

Improve Docker build security and efficiency for frontend#579

Merged
Nefrit0n merged 2 commits into
mainfrom
claude/fix-redis-startup-06y3Y
May 4, 2026
Merged

Improve Docker build security and efficiency for frontend#579
Nefrit0n merged 2 commits into
mainfrom
claude/fix-redis-startup-06y3Y

Conversation

@Nefrit0n

@Nefrit0n Nefrit0n commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves the Docker build configuration for the frontend application by implementing proper file ownership handling and adding a .dockerignore file to optimize build context.

Key Changes

  • File ownership in COPY commands: Added --chown=node:node flag to all COPY instructions in both development and production build stages. This ensures files are owned by the node user rather than root, improving security and consistency with the USER node directive.
  • Added .dockerignore file: Created a .dockerignore file to exclude unnecessary files and directories (node_modules, .vite, dist, .git, *.md) from the Docker build context, reducing build time and image size.

Implementation Details

  • The --chown flag is applied to both package dependency files and application source code copies
  • This change applies to both the development stage and the production build stage in the multi-stage Dockerfile
  • The .dockerignore exclusions prevent redundant copying of build artifacts, dependencies, and documentation that don't need to be in the container

https://claude.ai/code/session_012GkEL9VGqN4tT4uFJuEjq1

claude added 2 commits May 4, 2026 17:08
…tainer

Without --chown=node:node on COPY instructions, Docker copies files as root
even under USER node, causing node_modules/.vite writes to fail at runtime.
Added .dockerignore to prevent host node_modules from overwriting the npm ci
result inside the image.

https://claude.ai/code/session_012GkEL9VGqN4tT4uFJuEjq1
Config was at .github/.hadolint.yaml but workflow referenced
.github/workflows/.hadolint.yaml causing hadolint to fail.

https://claude.ai/code/session_012GkEL9VGqN4tT4uFJuEjq1
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@Nefrit0n Nefrit0n merged commit c230f18 into main May 4, 2026
14 checks passed
@Nefrit0n Nefrit0n deleted the claude/fix-redis-startup-06y3Y branch May 4, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants