update and add static webserver
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Jeffrey C. Ollie 2023-05-01 18:36:48 -05:00
parent 9bcae836f2
commit 175b0eb7c7
Signed by: jeff
GPG key ID: 6F86035A6D97044E
3 changed files with 41 additions and 8 deletions

View file

@ -29,6 +29,8 @@ steps:
- push-container result --repository network/healthchecks-maintenance - push-container result --repository network/healthchecks-maintenance
- nix build -L .#migrate - nix build -L .#migrate
- push-container result --repository network/healthchecks-migrate - push-container result --repository network/healthchecks-migrate
- nix build -L .#static
- push-container result --repository network/healthchecks-static
settings: settings:
registry: r.ocj.io registry: r.ocj.io
username: username:

View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1681648924, "lastModified": 1682879489,
"narHash": "sha256-pzi3HISK8+7mpEtv08Yr80wswyHKsz+RP1CROG1Qf6s=", "narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f294325aed382b66c7a188482101b0f336d1d7db", "rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -36,7 +36,7 @@
"PYTHONPATH=${self.packages.${system}.healthchecks.pythonPath}" "PYTHONPATH=${self.packages.${system}.healthchecks.pythonPath}"
"PYTHONUNBUFFERED=1" "PYTHONUNBUFFERED=1"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"STATIC_ROOT=${self.packages.${system}.healthchecks}/static" "STATIC_ROOT=${self.packages.${system}.healthchecks.static}"
]; ];
}; };
}; };
@ -76,6 +76,8 @@
inherit pname version propagatedBuildInputs; inherit pname version propagatedBuildInputs;
format = "other"; format = "other";
outputs = [ "out" "static" "doc" ];
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "healthchecks"; owner = "healthchecks";
repo = pname; repo = pname;
@ -83,13 +85,25 @@
inherit hash; inherit hash;
}; };
dontPatch = true;
dontConfigure = true;
dontBuild = true;
doCheck = false;
dontFixup = true;
installPhase = '' installPhase = ''
mkdir -p $out/app mkdir -p $out/app
cp -r . $out/app cp -r hc manage.py templates $out/app
chmod +x $out/app/manage.py chmod +x $out/app/manage.py
cp ${localSettings} $out/app/hc/local_settings.py cp ${localSettings} $out/app/hc/local_settings.py
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$out/static ${py}/bin/python $out/app/manage.py collectstatic --noinput
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$out/static ${py}/bin/python $out/app/manage.py compress mkdir -p $doc
cp -r *.md LICENSE $doc
mkdir -p $static
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$static ${py}/bin/python ./manage.py collectstatic --noinput
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$static ${py}/bin/python ./manage.py compress
cp -r static-collected/* $static
''; '';
passthru = { passthru = {
@ -198,7 +212,6 @@
plugins = python3 plugins = python3
post-buffering = 4096 post-buffering = 4096
processes = 4 processes = 4
static-map = /static=${self.packages.${system}.healthchecks}/static
threads = 1 threads = 1
thunder-lock thunder-lock
''; '';
@ -222,6 +235,24 @@
}; };
} }
); );
static = pkgs.dockerTools.buildLayeredImage {
name = "healthchecks-static";
tag = "latest";
maxLayers = 2;
config = {
User = "5000:5000";
Cmd = [
"${pkgs.static-web-server}/bin/static-web-server"
"--port=8000"
"--root=${self.packages.${system}.healthchecks.static}"
];
ExposedPorts = {
"8000/tcp" = { };
};
};
};
}; };
}; };
} }