feat: docker image for results component
This commit is contained in:
parent
f48d958a2c
commit
b0dd8cded1
@ -1,7 +1,27 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
let pname = "countries-page";
|
let
|
||||||
in {
|
pname = "results-summary-component";
|
||||||
# todo, building app
|
version = "0.0.1";
|
||||||
# building docker image
|
in rec {
|
||||||
|
package = pkgs.buildGoModule {
|
||||||
|
inherit pname version;
|
||||||
|
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
||||||
|
vendorHash = null; # set to "" when get dependencies in go.mod
|
||||||
|
};
|
||||||
|
image = pkgs.dockerTools.buildLayeredImage {
|
||||||
|
name = pname;
|
||||||
|
tag = "latest";
|
||||||
|
created = "now";
|
||||||
|
config = {
|
||||||
|
Cmd = [
|
||||||
|
"${package}/bin/results-summary-component-go"
|
||||||
|
"-p"
|
||||||
|
"8080"
|
||||||
|
"-h"
|
||||||
|
"0.0.0.0"
|
||||||
|
];
|
||||||
|
ExposedPorts = { "8080/tcp" = { }; };
|
||||||
|
};
|
||||||
|
};
|
||||||
# nixos module
|
# nixos module
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,12 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var port int
|
var port int
|
||||||
|
var host string
|
||||||
flag.IntVar(&port, "p", 8080, "Specify port for server to start on")
|
flag.IntVar(&port, "p", 8080, "Specify port for server to start on")
|
||||||
|
flag.StringVar(&host, "h", "localhost", "Specify host for server to start on")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
address := fmt.Sprintf("localhost:%d", port)
|
address := fmt.Sprintf("%s:%d", host, port)
|
||||||
log.Printf("starting server on %s", address)
|
log.Printf("starting server on %s", address)
|
||||||
log.Fatal(http.ListenAndServe(address, nil))
|
log.Fatal(http.ListenAndServe(address, nil))
|
||||||
}
|
}
|
||||||
|
BIN
17-results-summary-component-go/results-summary-component-go
Executable file
BIN
17-results-summary-component-go/results-summary-component-go
Executable file
Binary file not shown.
@ -36,6 +36,10 @@
|
|||||||
inherit pkgs sbt-derivation;
|
inherit pkgs sbt-derivation;
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
};
|
};
|
||||||
|
results-component-go = import ./17-results-summary-component-go {
|
||||||
|
inherit pkgs;
|
||||||
|
lib = pkgs.lib;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
@ -75,6 +79,8 @@
|
|||||||
nixosModules.multi-step-form = multi-step-form.module;
|
nixosModules.multi-step-form = multi-step-form.module;
|
||||||
packages.countries-page = countries-page.package;
|
packages.countries-page = countries-page.package;
|
||||||
packages.countries-page-image = countries-page.image;
|
packages.countries-page-image = countries-page.image;
|
||||||
|
packages.results-component-go = results-component-go.package;
|
||||||
|
packages.results-component-go-image = results-component-go.image;
|
||||||
});
|
});
|
||||||
# see https://serokell.io/blog/practical-nix-flakes
|
# see https://serokell.io/blog/practical-nix-flakes
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user