Skip to content
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

feat: Optimize Docker image, build for amd64+arm64 #173

Merged
merged 2 commits into from
Dec 1, 2024

Conversation

meyfa
Copy link
Member

@meyfa meyfa commented Dec 1, 2024

The image size is reduced by 13% using the following measures:

  • Extended .dockerignore to remove further metadata and tests. This also ensures better layer caching for repeat builds.
  • Cleaning npm cache for the final stage.

Inline source maps are enabled to improve error reporting. Stack traces will now refer to the TypeScript source locations instead of transpiled JS.

Multiplatform build for arm64 in addition to amd64 is enabled to improve performance on ARM devices due to not needing emulation.

Finally, the docker run example in README.md is amended to include security best practices.

Additional Context

N/A

Checklist

  • The pull request title meets the Conventional Commits specification and optionally includes the scope, for example: feat: Add social login

The image size is reduced by 13% using the following measures:

* Extended .dockerignore to remove further metadata and tests.
    This also ensures better layer caching for repeat builds.
* Cleaning npm cache for the final stage.

Inline source maps are enabled to improve error reporting. Stack traces will
now refer to the TypeScript source locations instead of transpiled JS.

Multiplatform build for arm64 in addition to amd64 is enabled to improve
performance on ARM devices due to not needing emulation.

Finally, the `docker run` example in README.md is amended to include
security best practices.
@meyfa meyfa requested a review from a team as a code owner December 1, 2024 12:15
lusu007
lusu007 previously approved these changes Dec 1, 2024
@meyfa
Copy link
Member Author

meyfa commented Dec 1, 2024

The PR build is unfortunately much slower now (around 8 minutes). This could be resolved by hosting the multistage build on an Arm64 runner (due to efficient x86_64 emulation, vs. the other way around), but these are not yet available for the GitHub free tier, unfortunately.

Source: https://github.blog/changelog/2024-09-03-github-actions-arm64-linux-and-windows-runners-are-now-generally-available/

@meyfa meyfa requested a review from lusu007 December 1, 2024 13:16
@lusu007 lusu007 merged commit 8d35b6d into main Dec 1, 2024
4 checks passed
@lusu007 lusu007 deleted the feat/optimize-docker branch December 1, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants