Compare commits

..

3 Commits

Author SHA1 Message Date
Tom Alexander
991f8aa2d8 Fix logging to stdout/stderr.
All checks were successful
build-staging Build build-staging has succeeded
2026-07-16 21:58:53 -04:00
Tom Alexander
9401ecc0c1 Use a /nginx directory for pid because /run doesn't exist when running in kubernetes.
All checks were successful
build-staging Build build-staging has succeeded
2026-07-16 21:38:31 -04:00
Tom Alexander
833a21dbf3 Add support for building the site via nix.
Some checks failed
build-staging Build build-staging has failed
2026-07-16 21:19:18 -04:00
2 changed files with 20 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ RUN --mount=type=ssh GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKno
# Export the built closure to a folder # Export the built closure to a folder
RUN mkdir /tmp/nix-store-closure RUN mkdir /tmp/nix-store-closure
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
RUN ln -s $(readlink -f /tmp/build/result/bin/sh) /tmp/sh
# Create a folder which will be copied to /tmp in the final image # Create a folder which will be copied to /tmp in the final image
RUN install -d -o root -g root -m 0777 will_be_tmp RUN install -d -o root -g root -m 0777 will_be_tmp
@@ -56,8 +57,9 @@ COPY --from=builder /tmp/ca-bundle.crt /etc/ssl/certs/ca-bundle.crt
COPY --from=builder /tmp/nix-store-closure /nix/store COPY --from=builder /tmp/nix-store-closure /nix/store
COPY --from=builder /tmp/build/result /app COPY --from=builder /tmp/build/result /app
COPY --from=builder /tmp/sh /bin/sh
COPY --from=builder /tmp/build/will_be_tmp /tmp COPY --from=builder /tmp/build/will_be_tmp /tmp
COPY --from=builder /tmp/build/will_be_slash_nginx /nginx COPY --from=builder /tmp/build/will_be_slash_nginx /nginx
EXPOSE 8080 EXPOSE 8080
CMD ["/app/nginx", "-c", "/app/nginx.conf", "-e", "stderr", "-g", "daemon off;"] CMD ["/app/bin/launch_nginx"]

View File

@@ -63,28 +63,20 @@
inherit system overlays; inherit system overlays;
}; };
appliedOverlay = self.overlays.default pkgs pkgs; appliedOverlay = self.overlays.default pkgs pkgs;
nginx_conf = pkgs.replaceVars "${./docker/server/nginx.conf}" {
web_root = appliedOverlay.homepage.release;
mime_types = "${pkgs.nginx}/conf/mime.types";
headers_include = "${./docker/server/headers.include}";
};
in in
rec { rec {
default = release; default = release;
inherit (appliedOverlay.homepage) inherit (appliedOverlay.homepage)
release release
; ;
docker_env = pkgs.stdenv.mkDerivation { docker_env = pkgs.buildEnv {
pname = "homepage-docker-env"; name = "homepage";
version = "0.0.0"; paths = with pkgs; [
appliedOverlay.homepage.launch_nginx
dontUnpack = true; bash
uutils-coreutils-noprefix
installPhase = '' # toybox # Smaller than uutils-coreutils?
mkdir -p $out ];
cp ${nginx_conf} $out/nginx.conf
ln -sf ${pkgs.nginx}/bin/nginx $out/nginx
'';
}; };
} }
); );
@@ -105,9 +97,17 @@
organic_ast_explorer = organic_ast_explorer'; organic_ast_explorer = organic_ast_explorer';
inherit homepage_private; inherit homepage_private;
}; };
nginx_conf = final.replaceVars "${./docker/server/nginx.conf}" {
web_root = release;
mime_types = "${final.nginx}/conf/mime.types";
headers_include = "${./docker/server/headers.include}";
};
launch_nginx = final.writeShellScriptBin "launch_nginx" ''
${final.nginx}/bin/nginx -c ${nginx_conf} -e stderr -g "daemon off;"
'';
in in
{ {
inherit release; inherit release launch_nginx;
} }
); );
}; };