Browse Source

chore: flake wip

C4illin 2 months ago
parent
commit
bba420386f
2 changed files with 44 additions and 45 deletions
  1. 42 44
      flake.nix
  2. 2 1
      package.json

+ 42 - 44
flake.nix

@@ -8,55 +8,53 @@
 
 
   outputs = { self, nixpkgs, flake-utils, ... }:
   outputs = { self, nixpkgs, flake-utils, ... }:
     flake-utils.lib.eachDefaultSystem (system:
     flake-utils.lib.eachDefaultSystem (system:
-      let
-        pkgs = import nixpkgs { inherit system; };
-        appSrc = ./.;
+      let pkgs = import nixpkgs { inherit system; };
+      appSrc = ./.;
 
 
-        app = pkgs.dockerTools.buildLayeredImage {
-          name = "convertx";
-          tag = "latest";
+      app = pkgs.dockerTools.buildLayeredImage {
+        name = "convertx";
+        tag = "latest";
 
 
-          contents = [
-            pkgs.bun
-            pkgs.resvg
-            pkgs.ffmpeg
-            pkgs.graphicsmagick
-            pkgs.ghostscript
-            pkgs.vips
-            pkgs.pandoc
-            pkgs.texlive.combined.scheme-full
-            pkgs.calibre
-            pkgs.inkscape
-            pkgs.poppler_utils
-            pkgs.assimp
-            pkgs.jxrlib
-            pkgs.libheif
-            pkgs.libjxl
-            pkgs.python3Packages.numpy
-          ];
+        contents = [
+          pkgs.bun
+          pkgs.resvg
+          pkgs.ffmpeg
+          pkgs.graphicsmagick
+          pkgs.ghostscript
+          pkgs.vips
+          pkgs.pandoc
+          pkgs.texlive.combined.scheme-full
+          pkgs.calibre
+          pkgs.inkscape
+          pkgs.poppler_utils
+          pkgs.assimp
+          pkgs.jxrlib
+          pkgs.libheif
+          pkgs.libjxl
+          pkgs.python3Packages.numpy
+        ];
 
 
-          config = {
-            Env = [
-              "NODE_ENV=production"
-              "PATH=/bin:/usr/bin"
-            ];
-            WorkingDir = "/app";
-            Cmd = [ "bun" "run" "./src/index.tsx" ];
-            ExposedPorts = {
-              "3000/tcp" = {};
-            };
+        config = {
+          Env = [
+            "NODE_ENV=production"
+            "PATH=/bin:/usr/bin"
+          ];
+          WorkingDir = "/app";
+          Cmd = [ "bun" "run" "./src/index.tsx" ];
+          ExposedPorts = {
+            "3000/tcp" = {};
           };
           };
-
-          extraCommands = ''
-            export PATH=${pkgs.bun}/bin:$PATH
-            mkdir -p app
-            cp -r ${appSrc}/* app/
-            cd app
-            bun install --frozen-lockfile --production
-            bun run build
-          '';
         };
         };
+
+        extraCommands = ''
+          export PATH=${pkgs.bun}/bin:$PATH
+          mkdir -p /app
+          cp -r ${./dist}/* /app/
+        '';
+      };
+
       in {
       in {
         packages.default = app;
         packages.default = app;
-      });
+      }
+    );
 }
 }

+ 2 - 1
package.json

@@ -4,6 +4,7 @@
   "scripts": {
   "scripts": {
     "dev": "bun run --watch src/index.tsx",
     "dev": "bun run --watch src/index.tsx",
     "hot": "bun run --hot src/index.tsx",
     "hot": "bun run --hot src/index.tsx",
+    "start": "bun run src/index.tsx",
     "format": "eslint --fix .",
     "format": "eslint --fix .",
     "build": "bunx @tailwindcss/cli -i ./src/main.css -o ./public/generated.css",
     "build": "bunx @tailwindcss/cli -i ./src/main.css -o ./public/generated.css",
     "lint": "run-p 'lint:*'",
     "lint": "run-p 'lint:*'",
@@ -51,4 +52,4 @@
     "typescript": "^5.8.3",
     "typescript": "^5.8.3",
     "typescript-eslint": "^8.32.0"
     "typescript-eslint": "^8.32.0"
   }
   }
-}
+}