mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
4ea88180d7
<!-- Thank you for submitting this PR! :) --> ## Description In order to test things quicker, we'd like to be able to build custom connector and friends in Nix, and then use the containers when running tests. First step here is to be able to build Docker containers in Nix, and add a CI job to ensure it still works. Then we'll move onto publishing and using these images. No-op build times: <img width="336" alt="Screenshot 2024-04-25 at 15 53 56" src="https://github.com/hasura/v3-engine/assets/4729125/47cbc0c5-6e54-4583-aa01-0528d4a21080"> Functional no-op. V3_GIT_ORIGIN_REV_ID: 8f9d609e26cdd3b0801e61fd361c241ad504dcdf
32 lines
791 B
Nix
32 lines
791 B
Nix
# This is a function that returns a derivation for a docker image.
|
|
{ dockerTools
|
|
, lib
|
|
, package
|
|
, image-name
|
|
, port
|
|
, architecture ? null
|
|
, tag ? null # defaults to the output hash
|
|
, extraConfig ? { } # see config options at: https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-field-descriptions
|
|
}:
|
|
|
|
let
|
|
seconds = 1000 * 1000 * 1000; # nanoseconds in 1 second
|
|
args = {
|
|
name = image-name;
|
|
created = "now";
|
|
contents = [ package ];
|
|
config = {
|
|
Entrypoint = [
|
|
"/bin/${package.pname}"
|
|
];
|
|
ExposedPorts = { "${port}/tcp" = { }; };
|
|
} // extraConfig;
|
|
}
|
|
// lib.optionalAttrs (tag != null) {
|
|
inherit tag;
|
|
} // lib.optionalAttrs (architecture != null) {
|
|
inherit architecture;
|
|
};
|
|
in
|
|
dockerTools.buildLayeredImage args
|