Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

reduce the size of the base image #19

Closed
wants to merge 2 commits into from
Closed

reduce the size of the base image #19

wants to merge 2 commits into from

Conversation

prusnak
Copy link
Member

@prusnak prusnak commented May 27, 2020

Fixes #18 by using --no-channel-add option to reduce the size of the base image

This is a breaking change! Users need to add the following into their Dockerfile files:

RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable
RUN nix-channel --update

@prusnak prusnak changed the title update nix to 2.3.5 update nix to 2.3.5 + reduce the size of the base image May 27, 2020
@domenkozar domenkozar requested a review from peti June 2, 2020 16:38
@prusnak prusnak changed the title update nix to 2.3.5 + reduce the size of the base image update nix to 2.3.6 + reduce the size of the base image Jun 3, 2020
@prusnak
Copy link
Member Author

prusnak commented Jun 3, 2020

Amended to include nix 2.3.6 which was released meanwhile

This is a breaking change! Users need to add the following into
their Dockerfile files:

RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable
RUN nix-channel --update
@prusnak
Copy link
Member Author

prusnak commented Jun 3, 2020

I think we can also remove these 3 lines because they are essentially a no-op now, but it does not hurt to keep them either:

docker/Dockerfile

Lines 21 to 23 in d4965ab

&& /nix/var/nix/profiles/default/bin/nix-collect-garbage --delete-old \
&& /nix/var/nix/profiles/default/bin/nix-store --optimise \
&& /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents

@peti
Copy link
Member

peti commented Jun 7, 2020

What makes you say those lines were a no-op?

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't mix two independent changes into one PR.

RUN wget https://nixos.org/releases/nix/nix-${NIX_VERSION}/nix-${NIX_VERSION}-x86_64-linux.tar.xz \
&& tar xf nix-${NIX_VERSION}-x86_64-linux.tar.xz \
&& addgroup -g 30000 -S nixbld \
&& for i in $(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user $i" -u $((30000 + i)) -G nixbld nixbld$i ; done \
&& mkdir -m 0755 /etc/nix \
&& echo 'sandbox = false' > /etc/nix/nix.conf \
&& mkdir -m 0755 /nix && USER=root sh nix-${NIX_VERSION}-x86_64-linux/install \
&& mkdir -m 0755 /nix && USER=root sh nix-${NIX_VERSION}-x86_64-linux/install --no-channel-add \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't add that change to this image because the change would break everyone's scripts and CI setups. Our users rely on the channel being registered.

@prusnak prusnak changed the title update nix to 2.3.6 + reduce the size of the base image reduce the size of the base image Jun 7, 2020
@prusnak
Copy link
Member Author

prusnak commented Jun 7, 2020

Upon further investigation, I realized the ca-bundle.crt is not installed when there is no channel present and there seems no obvious way out of this. Also, I've spent much more time on this than originally intended, so I am closing this.

@prusnak prusnak closed this Jun 7, 2020
@prusnak prusnak deleted the no-channel branch June 7, 2020 10:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nixpkgs-unstable included in the image
2 participants