Eliminate the shell from the docker image.
Some checks failed
build-staging Build build-staging has failed

This commit is contained in:
Tom Alexander
2026-07-17 08:19:17 -04:00
parent 49966f46fd
commit 72bbf09480
2 changed files with 18 additions and 20 deletions

View File

@@ -23,7 +23,6 @@ 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/toybox) /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
@@ -57,9 +56,8 @@ 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/bin/launch_nginx"] CMD ["/app/nginx", "-c", "/app/nginx.conf", "-e", "stderr", "-g", "daemon off;"]

View File

@@ -63,20 +63,28 @@
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.buildEnv { docker_env = pkgs.stdenv.mkDerivation {
name = "homepage"; pname = "homepage-docker-env";
paths = with pkgs; [ version = "0.0.0";
appliedOverlay.homepage.launch_nginx
# bash dontUnpack = true;
# uutils-coreutils-noprefix
# toybox # Smaller than uutils-coreutils? installPhase = ''
]; mkdir -p $out
cp ${nginx_conf} $out/nginx.conf
ln -sf ${pkgs.nginx}/bin/nginx $out/nginx
'';
}; };
} }
); );
@@ -97,17 +105,9 @@
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 launch_nginx; inherit release;
} }
); );
}; };