From beb2475195877546ed346de18cec440074d3fdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20Dos=C3=A9?= Date: Sat, 5 Aug 2023 11:07:54 -0700 Subject: [PATCH] Fix static serving of favicons --- Dockerfile | 4 ++-- lib/ambry_web.ex | 1 + lib/ambry_web/endpoint.ex | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 03df326b..c700d267 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,13 +77,13 @@ ARG MIX_ENV=prod ENV PHX_SERVER=true -USER nobody - COPY --from=elixir-builder --chown=nobody:nogroup /app /app RUN mkdir -p /app/uploads VOLUME /app/uploads +USER nobody + WORKDIR /app ENTRYPOINT ["/app/bin/ambry"] CMD ["start"] diff --git a/lib/ambry_web.ex b/lib/ambry_web.ex index 9c704f72..dc4cc49b 100644 --- a/lib/ambry_web.ex +++ b/lib/ambry_web.ex @@ -18,6 +18,7 @@ defmodule AmbryWeb do """ def static_paths, do: ~w(assets favicon.svg favicon.png favicon-32x32.png favicon-96x96.png robots.txt) + def static_matching, do: ~w(assets favicon robots) def router do quote do diff --git a/lib/ambry_web/endpoint.ex b/lib/ambry_web/endpoint.ex index 1ca7b060..099efe9b 100644 --- a/lib/ambry_web/endpoint.ex +++ b/lib/ambry_web/endpoint.ex @@ -20,8 +20,8 @@ defmodule AmbryWeb.Endpoint do plug Plug.Static, at: "/", from: :ambry, - gzip: false, - only: AmbryWeb.static_paths() + gzip: true, + only_matching: AmbryWeb.static_matching() # Serve static user uploaded images plug Plug.Static,