fix
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
parent
6dd28cab1e
commit
b1f6e6d823
40
default.nix
40
default.nix
|
@ -1,20 +1,26 @@
|
|||
{ system ? builtins.currentSystem }:
|
||||
|
||||
{ sources ? import ./nix/sources.nix, pkgs ? import <nixpkgs> { } }:
|
||||
let
|
||||
sources = import ./nix/sources.nix;
|
||||
pkgs = import <nixpkgs> { };
|
||||
printerfacts = import ./printerfacts.nix { inherit pkgs sources; };
|
||||
|
||||
name = "xena/printerfacts";
|
||||
tag = "latest";
|
||||
|
||||
in pkgs.dockerTools.buildLayeredImage {
|
||||
inherit name tag;
|
||||
contents = [ printerfacts ];
|
||||
|
||||
config = {
|
||||
Cmd = [ "${printerfacts}/bin/printerfacts" ];
|
||||
Env = [ "RUST_LOG=info" ];
|
||||
WorkingDir = "/";
|
||||
srcNoTarget = dir:
|
||||
builtins.filterSource
|
||||
(path: type: type != "directory" || builtins.baseNameOf path != "target")
|
||||
dir;
|
||||
naersk = pkgs.callPackage sources.naersk { };
|
||||
gruvbox-css = pkgs.callPackage sources.gruvbox-css { };
|
||||
src = srcNoTarget ./.;
|
||||
pfacts = naersk.buildPackage {
|
||||
inherit src;
|
||||
remapPathPrefix = true;
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit (pfacts) name;
|
||||
inherit src;
|
||||
phases = "installPhase";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/static
|
||||
|
||||
cp -rf $src/templates $out/templates
|
||||
cp -rf ${pfacts}/bin $out/bin
|
||||
cp -rf ${gruvbox-css}/gruvbox.css $out/static/gruvbox.css
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
{ system ? builtins.currentSystem }:
|
||||
|
||||
let
|
||||
sources = import ./nix/sources.nix;
|
||||
pkgs = import <nixpkgs> { };
|
||||
printerfacts = import ./default.nix { inherit pkgs sources; };
|
||||
|
||||
name = "xena/printerfacts";
|
||||
tag = "latest";
|
||||
|
||||
in pkgs.dockerTools.buildLayeredImage {
|
||||
inherit name tag;
|
||||
contents = [ printerfacts ];
|
||||
|
||||
config = {
|
||||
Cmd = [ "${printerfacts}/bin/printerfacts" ];
|
||||
Env = [ "RUST_LOG=info" ];
|
||||
WorkingDir = "/";
|
||||
};
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{ sources ? import ./nix/sources.nix, pkgs ? import <nixpkgs> { } }:
|
||||
let
|
||||
srcNoTarget = dir:
|
||||
builtins.filterSource
|
||||
(path: type: type != "directory" || builtins.baseNameOf path != "target")
|
||||
dir;
|
||||
naersk = pkgs.callPackage sources.naersk { };
|
||||
gruvbox-css = pkgs.callPackage sources.gruvbox-css { };
|
||||
src = srcNoTarget ./.;
|
||||
pfacts = naersk.buildPackage {
|
||||
inherit src;
|
||||
remapPathPrefix = true;
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit (pfacts) name;
|
||||
inherit src;
|
||||
phases = "installPhase";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/static
|
||||
|
||||
cp -rf $src/templates $out/templates
|
||||
cp -rf ${pfacts}/bin $out/bin
|
||||
cp -rf ${gruvbox-css}/gruvbox.css $out/static/gruvbox.css
|
||||
'';
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> { };
|
||||
dhall = import <dhall> { };
|
||||
in pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
rustc
|
||||
|
@ -8,9 +7,6 @@ in pkgs.mkShell {
|
|||
cargo-watch
|
||||
rls
|
||||
rustfmt
|
||||
|
||||
dhall.linux-dhall
|
||||
dhall.linux-dhall-yaml
|
||||
];
|
||||
|
||||
RUST_LOG = "info";
|
||||
|
|
|
@ -57,8 +57,12 @@ async fn main() -> anyhow::Result<()> {
|
|||
.and_then(index);
|
||||
|
||||
let not_found_handler = warp::any().and_then(not_found);
|
||||
let port = std::env::var("PORT")
|
||||
.unwrap_or("5000".into())
|
||||
.parse::<u16>()
|
||||
.expect("PORT to be a string-encoded u16");
|
||||
|
||||
log::info!("listening on port 5000");
|
||||
log::info!("listening on port {}", port);
|
||||
warp::serve(
|
||||
fact_handler
|
||||
.or(index_handler)
|
||||
|
@ -66,7 +70,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
.or(not_found_handler)
|
||||
.with(warp::log(APPLICATION_NAME)),
|
||||
)
|
||||
.run(([0, 0, 0, 0], 5000))
|
||||
.run(([0, 0, 0, 0], port))
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue