diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile index 3099156..d767bc1 100644 --- a/docker/server/Dockerfile +++ b/docker/server/Dockerfile @@ -23,7 +23,6 @@ RUN --mount=type=ssh GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o UserKno # Export the built closure to a folder RUN mkdir /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 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/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_slash_nginx /nginx EXPOSE 8080 -CMD ["/app/bin/launch_nginx"] +CMD ["/app/nginx", "-c", "/app/nginx.conf", "-e", "stderr", "-g", "daemon off;"] diff --git a/flake.nix b/flake.nix index a0f0111..97e4696 100644 --- a/flake.nix +++ b/flake.nix @@ -63,20 +63,28 @@ inherit system overlays; }; 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 rec { default = release; inherit (appliedOverlay.homepage) release ; - docker_env = pkgs.buildEnv { - name = "homepage"; - paths = with pkgs; [ - appliedOverlay.homepage.launch_nginx - # bash - # uutils-coreutils-noprefix - # toybox # Smaller than uutils-coreutils? - ]; + docker_env = pkgs.stdenv.mkDerivation { + pname = "homepage-docker-env"; + version = "0.0.0"; + + dontUnpack = true; + + 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'; 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 { - inherit release launch_nginx; + inherit release; } ); };