Skip to content

update Dockerfile to build distroless image #951

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

borja-rivera
Copy link

@borja-rivera borja-rivera commented Jul 16, 2025

This pull request updates the Dockerfile to use a distroless image for the production environment, simplifying the setup and improving security. The changes also adjust permissions and environment configurations to align with the new image.

Dockerfile updates for production:

  • Switched the base image for the production environment to gcr.io/distroless/nodejs18:nonroot, replacing the previous base image (node:18-alpine). This enhances security by minimizing the attack surface of the container.
  • Removed the creation of nodejs and nextjs system users and groups, as the distroless image operates without a shell or user management.
  • Simplified file copying by removing chown commands, as the distroless image does not require explicit ownership changes.

Environment and runtime configuration:

  • Added the CADENCE_WEB_PORT environment variable with a default value of 8088 and exposed port 8088 for the application.
  • Updated the CMD instruction to directly execute server.js, removing the shell-based command setup.

Testing

These changes have been tested on a staging cluster and the application works correctly with the new setup.

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.

2 participants