diff options
| author | Fuwn <[email protected]> | 2021-05-06 17:33:46 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-06 17:33:46 -0700 |
| commit | ba5cf895d7213efed871dd23a37622454dc228d1 (patch) | |
| tree | b70e2faf16e1c221aff44bf143a67ca3a361deae /docker.nix | |
| parent | etc: Remove useless CORS headers (diff) | |
| download | api-ba5cf895d7213efed871dd23a37622454dc228d1.tar.xz api-ba5cf895d7213efed871dd23a37622454dc228d1.zip | |
feat(global): :star:
Diffstat (limited to 'docker.nix')
| -rw-r--r-- | docker.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/docker.nix b/docker.nix new file mode 100644 index 0000000..8de863e --- /dev/null +++ b/docker.nix @@ -0,0 +1,43 @@ +{ system ? builtins.currentSystem }: + +let + sources = import ./nix/sources.nix; + pkgs = import sources.nixpkgs { }; + callPackage = pkgs.lib.callPackageWith pkgs; + senpy-api = callPackage ./default.nix { }; + + dockerImage = pkg: + pkgs.dockerTools.buildImage { + name = "senpy-club/api"; + tag = "latest"; + created = "now"; + + fromImage = pkgs.dockerTools.pullImage { + imageName = "alpine"; + imageDigest = "sha256:def822f9851ca422481ec6fee59a9966f12b351c62ccb9aca841526ffaa9f748"; + # https://nixos.wiki/wiki/Docker + # + # The above article didn't even work for me, ROFL. + # `nix-build docker.nix` threw an error about the sha256 being + # incorrect, but it also spat our the expected sha256... + # + # so I just replaced it... + sha256 = "1z6fh6ry14m5cpcjfg88vn2m36garmgdagr4vfc3pm1z3kph639n"; + finalImageTag = "alpine"; + finalImageName = "3.13.5"; + }; + + contents = [ pkg ]; + + config = { + Cmd = [ "run" ]; + WorkingDir = "/"; + Env = [ "PORT=80" ]; + ExposedPorts = { + "80/tcp" = { }; + }; + EntryPoint = [ "/bin/senpy-api" ]; + }; + }; + +in dockerImage senpy-api |