Drop slopdashes and add container build
This commit is contained in:
29
flake.nix
29
flake.nix
@@ -11,10 +11,13 @@
|
|||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
packageName = "tricu";
|
packageName = "tricu";
|
||||||
|
containerPackageName = "${packageName}-container";
|
||||||
|
|
||||||
haskellPackages = pkgs.haskellPackages;
|
haskellPackages = pkgs.haskellPackages;
|
||||||
hsLib = pkgs.haskell.lib;
|
hsLib = pkgs.haskell.lib;
|
||||||
|
|
||||||
|
tricuStatic = hsLib.justStaticExecutables self.packages.${system}.default;
|
||||||
|
|
||||||
tricuPackage =
|
tricuPackage =
|
||||||
haskellPackages.callCabal2nix packageName self {};
|
haskellPackages.callCabal2nix packageName self {};
|
||||||
|
|
||||||
@@ -60,5 +63,31 @@
|
|||||||
tricuPackage
|
tricuPackage
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
devShell = self.devShells.${system}.default;
|
||||||
|
|
||||||
|
packages.${containerPackageName} = pkgs.dockerTools.buildImage {
|
||||||
|
name = "tricu";
|
||||||
|
|
||||||
|
copyToRoot = pkgs.buildEnv {
|
||||||
|
name = "image-root";
|
||||||
|
paths = [ tricuStatic ];
|
||||||
|
pathsToLink = [ "/bin" ];
|
||||||
|
};
|
||||||
|
tag = "latest";
|
||||||
|
config = {
|
||||||
|
Cmd = [
|
||||||
|
"/bin/tricu"
|
||||||
|
"server"
|
||||||
|
"-h" "0.0.0.0"
|
||||||
|
"-p" "8787"
|
||||||
|
];
|
||||||
|
WorkingDir = "/app";
|
||||||
|
ExposedPorts = {
|
||||||
|
"8787/tcp" = {};
|
||||||
|
};
|
||||||
|
extraCommands = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ main = do
|
|||||||
in compileFile compileInputFile compileOutFile bundleExportName
|
in compileFile compileInputFile compileOutFile bundleExportName
|
||||||
Serve { host = hostStr, port = portNum } -> do
|
Serve { host = hostStr, port = portNum } -> do
|
||||||
putStrLn $ "Starting Arborix bundle server on " ++ hostStr ++ ":" ++ show portNum
|
putStrLn $ "Starting Arborix bundle server on " ++ hostStr ++ ":" ++ show portNum
|
||||||
putStrLn $ " GET /bundle/hash/:hash — primary endpoint"
|
putStrLn $ " GET /bundle/hash/:hash -- primary endpoint"
|
||||||
putStrLn $ " GET /bundle/name/:name — convenience endpoint"
|
putStrLn $ " GET /bundle/name/:name -- convenience endpoint"
|
||||||
putStrLn $ " Content-Type: application/vnd.arborix.bundle"
|
putStrLn $ " Content-Type: application/vnd.arborix.bundle"
|
||||||
runServer hostStr portNum
|
runServer hostStr portNum
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ import qualified Data.Text as T
|
|||||||
--
|
--
|
||||||
-- Endpoints
|
-- Endpoints
|
||||||
-- ---------
|
-- ---------
|
||||||
-- GET /health — 200 "ok"
|
-- GET /health - 200 "ok"
|
||||||
-- GET /bundle/name/:name — export by stored term name
|
-- GET /bundle/name/:name - export by stored term name
|
||||||
-- GET /bundle/hash/:hash — export by full Merkle hash
|
-- GET /bundle/hash/:hash - export by full Merkle hash
|
||||||
-- GET /terms — plain-text listing (debug)
|
-- GET /terms - plain-text listing (debug)
|
||||||
--
|
--
|
||||||
runServer :: String -> Int -> IO ()
|
runServer :: String -> Int -> IO ()
|
||||||
runServer hostStr port =
|
runServer hostStr port =
|
||||||
|
|||||||
Reference in New Issue
Block a user