From f42aab286a90438177d310e39ca53262b51daee4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 26 Mar 2024 08:54:20 -0700 Subject: [PATCH] [Bugfix] Expose port in Dockerfile and force IPv4 (#129) * Exposes port on built image * Forced IPv4 * Added current version to sidebar --- config/runtime.exs | 2 +- .../components/layouts/partials/sidebar.html.heex | 5 +++++ selfhosted.Dockerfile | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index d2a9335..6c0d6cd 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -102,7 +102,7 @@ if config_env() == :prod do # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html # for details about using IPv6 vs IPv4 and loopback vs public addresses. - ip: {0, 0, 0, 0, 0, 0, 0, 0}, + ip: {0, 0, 0, 0}, port: String.to_integer(System.get_env("PORT") || "4000") ], secret_key_base: secret_key_base diff --git a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex index 1ac1d8d..fc34749 100644 --- a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex +++ b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex @@ -57,6 +57,11 @@ <.icon name="hero-currency-dollar" /> Donate +
  • + + v<%= Application.spec(:pinchflat)[:vsn] %> + +
  • diff --git a/selfhosted.Dockerfile b/selfhosted.Dockerfile index 5f7f128..d861cd0 100644 --- a/selfhosted.Dockerfile +++ b/selfhosted.Dockerfile @@ -75,6 +75,8 @@ RUN mix release # the compiled release and other runtime necessities FROM ${RUNNER_IMAGE} +ARG PORT=8945 + RUN apt-get update -y RUN apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \ ffmpeg curl git openssh-client nano @@ -101,8 +103,9 @@ RUN chown nobody /config /downloads # set runner ENV ENV MIX_ENV="prod" -ENV PORT=8945 +ENV PORT=${PORT} ENV RUN_CONTEXT="selfhosted" +EXPOSE ${PORT} # Only copy the final release from the build stage COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/pinchflat ./