From 8137dc9bc8dcbeb5723b9b5b29d07425774662aa Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Thu, 4 Jan 2024 18:10:24 +0530 Subject: [PATCH] dockerize --- .dockerignore | 7 +++++++ Dockerfile | 10 ++++++++++ flake.nix | 7 ++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..971fbd3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.direnv/ +.git/ +.github/ +.pub/ +result +update-version.sh +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ac8b9c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM nixos/nix:latest +WORKDIR /app +COPY . . + +RUN nix \ + --extra-experimental-features "nix-command flakes" \ + build .#app + +CMD [ "/app/result/bin/app" ] + diff --git a/flake.nix b/flake.nix index 3b18a7f..896db7d 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,8 @@ pkgs = import nixpkgs { inherit system; }; + package = pkgs.callPackage ./default.nix { }; + app = pkgs.writeShellScriptBin "app" "${pkgs.merecat}/bin/merecat -n -p 8080 ${package}/share/web"; in { formatter = pkgs.nixpkgs-fmt; @@ -26,7 +28,10 @@ pkgs.zs ]; }; - packages.default = pkgs.callPackage ./default.nix { }; + packages = { + inherit app; + default = package; + }; } ); }