Skip to content

Commit

Permalink
chore: add a user non-root to the container image (#38)
Browse files Browse the repository at this point in the history
- Running as root is never good! Never! 🍒
  • Loading branch information
gabyx authored Jul 16, 2024
1 parent 1a6decc commit 5afc828
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/nix/images/tripsu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ pkgs.dockerTools.buildLayeredImage {

contents = [tripsu];

fakeRootCommands = ''
${pkgs.dockerTools.shadowSetup}
groupadd -r non-root
useradd -r -g non-root non-root
mkdir -p /workspace
chown non-root:non-root /workspace
'';
enableFakechroot = true;

config = {
Entrypoint = ["tripsu"];
WorkingDir = "/";
WorkingDir = "/workspace";
Labels = {
"org.opencontainers.image.source" = "https://github.com/sdsc-ordes/tripsu";
"org.opencontainers.image.description" = tripsu.meta.description;
"org.opencontainers.image.license" = "Apache-2.0";
};
User = "non-root";
};
}

0 comments on commit 5afc828

Please sign in to comment.