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

Improved docker #16

Merged
merged 7 commits into from
Dec 14, 2023
Merged

Improved docker #16

merged 7 commits into from
Dec 14, 2023

Conversation

cmdoret
Copy link
Member

@cmdoret cmdoret commented Nov 24, 2023

This PR fixes and improves the Dockerfile as follows:

  • Multi-stage build with cargo chef
    • Cargo-chef caches compiled dependencies in an intermediate layer. This makes docker build fast as long as dependencies do not change, because only the project code must be recompiled.
  • Use Google's debian "distroless" image as the base layer for the runner layer. It is a stripped down linux system with libc (no package manager or anything)
    • This brings the image size down to 31MB
    • The image has very few vulnerabilities (trivy finds 13 low and 4 medium CVEs)
  • Use an unprivileged user in the container

@cmdoret cmdoret self-assigned this Nov 24, 2023
@cmdoret cmdoret added the enhancement New feature or request label Nov 24, 2023
@cmdoret
Copy link
Member Author

cmdoret commented Dec 4, 2023

Notes from @martinfontanet :

  • Avoid COPY . if you can specify files
  • Check if user creation can be simplified

@cmdoret cmdoret merged commit 8e7d7a5 into main Dec 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant