Skip to content

Commit

Permalink
Use streaming layered images instead of building (#1576)
Browse files Browse the repository at this point in the history
- Should be less stuff in the nix store
  • Loading branch information
noonio authored Aug 19, 2024
1 parent e7beaea commit 368f18a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:
run: |
IMAGE_NAME=ghcr.io/${{github.repository_owner}}/${{matrix.target}}
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
nix build .#docker-${{ matrix.target }} && docker load < ./result
nix build .#docker-${{ matrix.target }}
./result | docker load
# Determine whether we are building a tag and if yes, set a VERSION_NAME
BUILDING_TAG=${{github.ref_type == 'tag'}}
[[ ${BUILDING_TAG} = true ]] && \
Expand Down
12 changes: 6 additions & 6 deletions nix/hydra/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let
pkgs = import nixpkgs { inherit system; };
in
{
hydra-node = pkgs.dockerTools.buildImage {
hydra-node = pkgs.dockerTools.streamLayeredImage {
name = "hydra-node";
tag = "latest";
created = "now";
Expand All @@ -18,7 +18,7 @@ in
};
};

hydra-tui = pkgs.dockerTools.buildImage {
hydra-tui = pkgs.dockerTools.streamLayeredImage {
name = "hydra-tui";
tag = "latest";
created = "now";
Expand All @@ -27,7 +27,7 @@ in
};
};

hydra-explorer = pkgs.dockerTools.buildImage {
hydra-explorer = pkgs.dockerTools.streamLayeredImage {
name = "hydra-explorer";
tag = "latest";
created = "now";
Expand All @@ -36,23 +36,23 @@ in
WorkingDir = "/";
};
# Copy the static files to the /static in the docker image
copyToRoot = [
contents = [
(pkgs.runCommand "hydra-explorer-static-files" { } ''
mkdir $out
ln -s ${hydraPackages.hydra-explorer-web} $out/static
'')
];
};

hydraw = pkgs.dockerTools.buildImage {
hydraw = pkgs.dockerTools.streamLayeredImage {
name = "hydraw";
tag = "latest";
created = "now";
config = {
Entrypoint = [ "${hydraPackages.hydraw-static}/bin/hydraw" ];
WorkingDir = "/static";
};
copyToRoot = [
contents = [
(pkgs.runCommand "hydraw-static-files" { } ''
mkdir $out
ln -s ${../../hydraw/static} $out/static
Expand Down

0 comments on commit 368f18a

Please sign in to comment.