{ buildToolbox
, postgrest
, dockerTools
, checkedShellScript
}:
let
  image =
    dockerTools.buildImage {
      name = "postgrest";
      tag = "latest";
      contents = postgrest;

      # Set the current time as the image creation date. This makes the build
      # non-reproducible, but that should not be an issue for us.
      created = "now";

      extraCommands =
        ''
          rmdir share
        '';

      config = {
        Cmd = [ "/bin/postgrest" ];
        User = "1000";
        ExposedPorts = {
          "3000/tcp" = { };
        };
      };
    };

  load =
    checkedShellScript
      {
        name = "postgrest-docker-load";
        docs = "Load the PostgREST image into Docker.";
      }
      ''
        docker load -i ${image}
      '';

in
buildToolbox
{
  name = "postgrest-docker";
  tools = [ load ];
  extra = {
    inherit image;
  };
}

{ buildToolbox
, postgrest
, dockerTools
, checkedShellScript
}:
let
  image =
    dockerTools.buildImage {
      name = "postgrest";
      tag = "latest";
      copyToRoot = postgrest;

      # Set the current time as the image creation date. This makes the build
      # non-reproducible, but that should not be an issue for us.
      created = "now";

      extraCommands =
        ''
          rmdir share
        '';

      config = {
        Cmd = [ "/bin/postgrest" ];
        User = "1000";
        ExposedPorts = {
          "3000/tcp" = { };
        };
      };
    };

  load =
    checkedShellScript
      {
        name = "postgrest-docker-load";
        docs = "Load the PostgREST image into Docker.";
      }
      ''
        docker load -i ${image}
      '';

in
buildToolbox
{
  name = "postgrest-docker";
  tools = [ load ];
  extra = {
    inherit image;
  };
}

Remove deprecation warning for dockerTools.buildImage { contents }
nix: Remove deprecation warning for dockerTools.buildImage { contents }

Signed-off-by: Wolfgang Walther <b9d1f5165dffc938d90c9c9e2e159e5f98731697@technowledgy.de>
