nix: make docker work!!!!!
This commit is contained in:
parent
b1d988671c
commit
03e38f566d
7 changed files with 24 additions and 28 deletions
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
if [[ ! -d "/home/noe/dev/git.sapphic.engineer/noe/plapkit" ]]; then
|
||||
echo "Cannot find source directory; Did you move it?"
|
||||
echo "(Looking for "/home/noe/dev/git.sapphic.engineer/noe/plapkit")"
|
||||
echo 'Cannot force reload with this script - use "direnv reload" manually and then try again'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rebuild the cache forcefully
|
||||
_nix_direnv_force_reload=1 direnv exec "/home/noe/dev/git.sapphic.engineer/noe/plapkit" true
|
||||
|
||||
# Update the mtime for .envrc.
|
||||
# This will cause direnv to reload again - but without re-building.
|
||||
touch "/home/noe/dev/git.sapphic.engineer/noe/plapkit/.envrc"
|
||||
|
||||
# Also update the timestamp of whatever profile_rc we have.
|
||||
# This makes sure that we know we are up to date.
|
||||
touch -r "/home/noe/dev/git.sapphic.engineer/noe/plapkit/.envrc" "/home/noe/dev/git.sapphic.engineer/noe/plapkit/.direnv"/*.rc
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
.direnv
|
||||
.direnv/
|
||||
result
|
||||
.env
|
12
flake.nix
12
flake.nix
|
@ -21,13 +21,13 @@
|
|||
# fromImage = baseImage;
|
||||
name = "noe/plapkit";
|
||||
tag = "latest";
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "image-root";
|
||||
paths = [ packages.default ];
|
||||
pathsToLink = [ "/bin" ];
|
||||
};
|
||||
|
||||
copyToRoot = [
|
||||
pkgs.dockerTools.caCertificates
|
||||
];
|
||||
|
||||
config = {
|
||||
Cmd = [ "/bin/plapkit" ];
|
||||
Cmd = [ "${packages.default}/bin/plapkit" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
6
justfile
Normal file
6
justfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
buildc:
|
||||
nix build .#container
|
||||
|
||||
runc:
|
||||
podman load < result
|
||||
podman run -it --rm -p8555:8555 localhost/noe/plapkit:latest
|
10
main.go
10
main.go
|
@ -22,6 +22,7 @@ func main() {
|
|||
|
||||
// our routes
|
||||
mux.HandleFunc("/hook/{token}", postGetHookToken)
|
||||
mux.HandleFunc("/healthcheck", getHealthcheck)
|
||||
|
||||
// prometheus
|
||||
mux.Handle("/metrics", promhttp.Handler())
|
||||
|
@ -68,3 +69,12 @@ func basicNoContent(rw http.ResponseWriter) {
|
|||
rw.WriteHeader(http.StatusNoContent)
|
||||
rw.Write([]byte("204 No Content (debug: likely not handled)"))
|
||||
}
|
||||
|
||||
func getHealthcheck(rw http.ResponseWriter, req *http.Request) {
|
||||
_, err := pkApi.GetMember("iodbz")
|
||||
if err != nil {
|
||||
log.Println("[HEALTHCHECK FAIL] failed to reach pluralkit", err)
|
||||
errStatusInternalServerError(rw)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{ ... }: {}
|
1
result
1
result
|
@ -1 +0,0 @@
|
|||
/nix/store/cnnxb0z1g23wmaaigskrbdxfa566n97h-docker-image-plapkit.tar.gz
|
Loading…
Add table
Reference in a new issue