[wip] slim image
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Vivian 2022-12-08 20:48:17 +01:00
parent 8103df4e0a
commit 37045b75a0
2 changed files with 35 additions and 6 deletions

View file

@ -17,16 +17,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1670064435,
"narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=",
"lastModified": 1670525689,
"narHash": "sha256-YIjGzxrRQa5LYO0zlnH/ardcwXsRgsnHe3TkGkvCxbc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c",
"rev": "f21f11aa2a02cb78651c6d57546c7d7541f9240c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -1,7 +1,7 @@
{
description = "woodpecker plugin for building and pushing nix containers";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/master";
flake-utils.url = "github:numtide/flake-utils";
};
@ -39,7 +39,7 @@
packages = {
container = pkgs.dockerTools.buildLayeredImage {
name = image-name;
tag = "main";
tag = "edge";
maxLayers = 125;
fromImage = pkgs.dockerTools.pullImage {
imageName = "nixos/nix";
@ -53,6 +53,35 @@
Env = [ "NIX_CONFIG=experimental-features = nix-command flakes" ];
};
};
# Does not work
slim = pkgs.dockerTools.buildLayeredImage {
name = "${image-name}-slim";
tag = "edge";
contents = pkgs.buildEnv {
name = "env";
paths = with pkgs;
with pkgs.dockerTools; [
nixUnstable
shadow
crane
busybox
gitMinimal
caCertificates
usrBinEnv
];
};
config = {
Env = [
"USER=root"
''NIX_REMOTE=''
''
NIX_CONFIG=
experimental-features = nix-command flakes auto-allocate-uids
auto-allocate-uids = true
sandbox = false''
];
};
};
};
devShells.default =
pkgs.mkShell { buildInputs = with pkgs; [ crane gzip ]; };