Skip to content

Conversation

@rossnelson
Copy link
Collaborator

Summary

This PR optimizes Docker builds for the ui-server by:

  • Adding a .dockerignore file to exclude unnecessary files from the build context
  • Improving Dockerfile structure with combined RUN commands and better layer organization
  • Enhancing security by using --chown in COPY commands and switching to non-root user before ENTRYPOINT

These changes reduce image size, improve build performance, and enhance security posture.

Changes

New .dockerignore file:

  • Excludes version control, documentation, tests, development files, build artifacts, IDE configs, and CI/CD files from Docker build context
  • Reduces build context size and improves cache efficiency

Dockerfile improvements:

  • Combine multiple RUN commands using && to reduce image layers
  • Use --chown=temporal:temporal in COPY commands instead of separate chown command
  • Add USER temporal before ENTRYPOINT for better security
  • Remove unnecessary comment dividers for cleaner structure
  • Move ENV before ENTRYPOINT for proper ordering

Note

This addresses the issue raised in temporalio/ui-server#327, which was opened against the wrong repository. Changes should be made to ui/server which syncs to ui-server automatically.

… Dockerfile

- Add .dockerignore to exclude unnecessary files from build context
- Combine RUN commands to reduce image layers
- Use --chown in COPY commands for better efficiency
- Switch to non-root user before ENTRYPOINT for improved security
@rossnelson rossnelson requested a review from a team as a code owner November 13, 2025 15:22
@rossnelson rossnelson requested review from laurakwhit and removed request for a team November 13, 2025 15:22
@vercel
Copy link

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
holocene Ready Ready Preview Comment Nov 13, 2025 3:23pm

@rossnelson rossnelson merged commit d2a09d4 into main Nov 14, 2025
15 checks passed
@rossnelson rossnelson deleted the optimize-docker-builds branch November 14, 2025 02:26
temporal-cicd bot pushed a commit that referenced this pull request Dec 18, 2025
Auto-generated version bump from 2.43.3 to 2.44.0

Bump type: minor

Changes included:
- [`d2a09d40`](d2a09d4) chore(server): optimize Docker builds with .dockerignore and improved Dockerfile (#3014)
- [`0ae7ce08`](0ae7ce0) Add run Id when fetching initial values for workflow start (#3019)
- [`2abd6ba0`](2abd6ba) Add route for archived event history (#3023)
- [`20c692df`](20c692d) Move ziggy png under src/lib/vendor and import it (#3025)
- [`0ba531d8`](0ba531d) Fix custom public path for render endpoint (#3024)
- [`564dcfa9`](564dcfa) Add deprecate to pluralize. (#3026)
- [`80b78303`](80b7830) DT-3307 - add custom timestamp formats (#3021)
- [`be7fe154`](be7fe15) Remove timestamp from timeline axis (#3031)
- [`07dec31d`](07dec31) Clear Schedule timeouts (#3030)
- [`34fdd3a4`](34fdd3a) Only add link if deployment is defined (#3035)
- [`d59320d1`](d59320d) If greater than 1 attempt, set actions to 0 (#3045)
- [`a7629a24`](a7629a2) Bump mdast-util-to-hast from 13.2.0 to 13.2.1 (#3046)
- [`37159d8f`](37159d8) Bump express from 4.20.0 to 4.22.0 (#3047)
- [`4faf9843`](4faf984) feat(search-attributes): add isDeletable (#3041)
- [`37a0a691`](37a0a69) Audit identity field in APIs (#3018)
- [`fe84adcc`](fe84adc) update Menu and related components to runes mode (#3048)
- [`378a4699`](378a469) Fix empty state png (#3053)
- [`bd4dfba2`](bd4dfba) Dangerfile (#3043)
- [`82a9971f`](82a9971) fix event-details-link href creation (#3055)
- [`23885f39`](23885f3) Support forwarding binary headers (#3000)
- [`f8b38697`](f8b3869) fix(codec-server): add spacing between action buttons (#3058)
- [`4495de9a`](4495de9) Fix poller reduce logic for pollers with different identities (#3057)
- [`271edd95`](271edd9) fix: update Go to 1.24.11 to fix stdlib security vulnerabilities (#3059)
- [`20ab1a28`](20ab1a2) fix batch operation close time (#3060)
- [`19a64bf7`](19a64bf) Add schedule link (#3061)
- [`0c7597c9`](0c7597c) Change from 2 to 1 (#3062)
- [`7c74da94`](7c74da9) Time range bug fix (#3050)
- [`8a5b5fad`](8a5b5fa) fix(select): make Option children a required prop (#3068)
- [`ce4e9a9c`](ce4e9a9) Scheduled by filter updates (#3063)
- [`8faf0420`](8faf042) Update ns picker value based on page params (#3065)
- [`06ca2389`](06ca238) Make custom signal first (#3069)
- [`2f2adc39`](2f2adc3) fix: address security vulnerabilities in dependencies (#3056)
Alex-Tideman added a commit that referenced this pull request Dec 18, 2025
Auto-generated version bump from 2.43.3 to 2.44.0

Bump type: minor

Changes included:
- [`d2a09d40`](d2a09d4) chore(server): optimize Docker builds with .dockerignore and improved Dockerfile (#3014)
- [`0ae7ce08`](0ae7ce0) Add run Id when fetching initial values for workflow start (#3019)
- [`2abd6ba0`](2abd6ba) Add route for archived event history (#3023)
- [`20c692df`](20c692d) Move ziggy png under src/lib/vendor and import it (#3025)
- [`0ba531d8`](0ba531d) Fix custom public path for render endpoint (#3024)
- [`564dcfa9`](564dcfa) Add deprecate to pluralize. (#3026)
- [`80b78303`](80b7830) DT-3307 - add custom timestamp formats (#3021)
- [`be7fe154`](be7fe15) Remove timestamp from timeline axis (#3031)
- [`07dec31d`](07dec31) Clear Schedule timeouts (#3030)
- [`34fdd3a4`](34fdd3a) Only add link if deployment is defined (#3035)
- [`d59320d1`](d59320d) If greater than 1 attempt, set actions to 0 (#3045)
- [`a7629a24`](a7629a2) Bump mdast-util-to-hast from 13.2.0 to 13.2.1 (#3046)
- [`37159d8f`](37159d8) Bump express from 4.20.0 to 4.22.0 (#3047)
- [`4faf9843`](4faf984) feat(search-attributes): add isDeletable (#3041)
- [`37a0a691`](37a0a69) Audit identity field in APIs (#3018)
- [`fe84adcc`](fe84adc) update Menu and related components to runes mode (#3048)
- [`378a4699`](378a469) Fix empty state png (#3053)
- [`bd4dfba2`](bd4dfba) Dangerfile (#3043)
- [`82a9971f`](82a9971) fix event-details-link href creation (#3055)
- [`23885f39`](23885f3) Support forwarding binary headers (#3000)
- [`f8b38697`](f8b3869) fix(codec-server): add spacing between action buttons (#3058)
- [`4495de9a`](4495de9) Fix poller reduce logic for pollers with different identities (#3057)
- [`271edd95`](271edd9) fix: update Go to 1.24.11 to fix stdlib security vulnerabilities (#3059)
- [`20ab1a28`](20ab1a2) fix batch operation close time (#3060)
- [`19a64bf7`](19a64bf) Add schedule link (#3061)
- [`0c7597c9`](0c7597c) Change from 2 to 1 (#3062)
- [`7c74da94`](7c74da9) Time range bug fix (#3050)
- [`8a5b5fad`](8a5b5fa) fix(select): make Option children a required prop (#3068)
- [`ce4e9a9c`](ce4e9a9) Scheduled by filter updates (#3063)
- [`8faf0420`](8faf042) Update ns picker value based on page params (#3065)
- [`06ca2389`](06ca238) Make custom signal first (#3069)
- [`2f2adc39`](2f2adc3) fix: address security vulnerabilities in dependencies (#3056)

Co-authored-by: Alex-Tideman <7967403+Alex-Tideman@users.noreply.github.com>
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