Skip to content

Commit 5819338

Browse files
Optimize Docker Image Size by Cleaning Nix Store (#2486)
## Summary This MR modifies the Dockerfile to reduce the final image size by optimizing the Nix store after installing packages. Added `nix-store --gc` and `nix-store --optimise` commands to clean up and optimize the Nix store after package installation. ## How was it tested? Built the Docker image locally and verified the image size reduction. Confirmed that the application runs as expected after the changes.
1 parent dc50eb5 commit 5819338

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/devbox/generate/tmpl/dev.Dockerfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY devbox.lock devbox.lock
2121
{{range $i, $element := .LocalFlakeDirs -}}
2222
COPY {{$element}} {{$element}}
2323
{{end}}
24-
RUN devbox run -- echo "Installed Packages."
24+
RUN devbox run -- echo "Installed Packages." && nix-store --gc && nix-store --optimise
2525
{{if .IsDevcontainer}}
2626
RUN devbox shellenv --init-hook >> ~/.profile
2727
{{- else}}

0 commit comments

Comments
 (0)