cleanup
This commit is contained in:
parent
8ca4ea2e2b
commit
184ca52a8c
3 changed files with 0 additions and 87 deletions
|
|
@ -29,8 +29,6 @@ COPY mix.exs mix.lock ./
|
|||
# Copy vendor directory for local dependencies
|
||||
COPY vendor vendor
|
||||
RUN mix deps.get --only $MIX_ENV
|
||||
# Extract the APRS parser hash from the vendored directory
|
||||
RUN cd vendor/aprs && git rev-parse HEAD | cut -c1-7 > /tmp/aprs_hash.txt
|
||||
RUN mix deps.compile
|
||||
|
||||
# Copy application code
|
||||
|
|
@ -65,12 +63,6 @@ RUN mkdir -p /app
|
|||
# Set deployment timestamp to current time during runtime container build
|
||||
RUN date -u +"%Y-%m-%dT%H:%M:%SZ" > /app/deployed_at.txt
|
||||
|
||||
# Copy APRS parser hash from builder stage
|
||||
COPY --from=builder /tmp/aprs_hash.txt /app/aprs_hash.txt
|
||||
|
||||
# Set APRS parser hash environment variable for runtime
|
||||
RUN APRS_HASH=$(cat /app/aprs_hash.txt) && echo "APRS_PARSER_HASH=$APRS_HASH" >> /etc/environment
|
||||
|
||||
# Copy release from builder
|
||||
COPY --from=builder --chown=nobody:root /app/release ./
|
||||
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
defmodule Aprsme.DependencyInfo do
|
||||
@moduledoc """
|
||||
Provides information about dependencies, particularly for production builds.
|
||||
"""
|
||||
|
||||
alias Aprsme.CircuitBreaker
|
||||
|
||||
@doc """
|
||||
Gets the SHA1 hash of the aprs library currently being used.
|
||||
In development: reads from vendor/aprs directory
|
||||
In production: uses the hash captured at compile time
|
||||
"""
|
||||
def get_aprs_library_sha do
|
||||
# First try environment variable (production)
|
||||
case System.get_env("APRS_PARSER_HASH") do
|
||||
nil -> get_aprs_sha_from_vendor()
|
||||
"unknown" -> get_aprs_sha_from_vendor()
|
||||
hash -> hash
|
||||
end
|
||||
end
|
||||
|
||||
defp get_aprs_sha_from_vendor do
|
||||
vendor_path = Path.join([File.cwd!(), "vendor", "aprs"])
|
||||
|
||||
if File.dir?(vendor_path) do
|
||||
case System.cmd("git", ["rev-parse", "HEAD"], cd: vendor_path) do
|
||||
{sha, 0} -> String.slice(String.trim(sha), 0, 7)
|
||||
_ -> nil
|
||||
end
|
||||
end
|
||||
rescue
|
||||
_ -> nil
|
||||
end
|
||||
|
||||
def latest_aprs_library_sha do
|
||||
case CircuitBreaker.call(
|
||||
:github_api,
|
||||
fn ->
|
||||
resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main")
|
||||
body = resp.body
|
||||
sha = body["sha"] || body |> Jason.decode!() |> Access.get("sha")
|
||||
String.slice(sha, 0, 7)
|
||||
end,
|
||||
10_000
|
||||
) do
|
||||
{:ok, sha} -> sha
|
||||
{:error, _} -> nil
|
||||
end
|
||||
end
|
||||
|
||||
def is_latest_aprs_library? do
|
||||
get_aprs_library_sha() == latest_aprs_library_sha()
|
||||
end
|
||||
end
|
||||
|
|
@ -14,8 +14,6 @@ defmodule AprsmeWeb.StatusLive.Index do
|
|||
page_title: "System Status",
|
||||
aprs_status: get_aprs_status(),
|
||||
version: get_app_version(),
|
||||
aprs_library_sha: get_aprs_library_sha(),
|
||||
is_latest_aprs_library: Aprsme.DependencyInfo.is_latest_aprs_library?(),
|
||||
current_time: DateTime.utc_now(),
|
||||
health_score: calculate_health_score(get_aprs_status())
|
||||
)
|
||||
|
|
@ -60,25 +58,6 @@ defmodule AprsmeWeb.StatusLive.Index do
|
|||
<span class="text-sm font-medium opacity-70 mr-2">{gettext("Version:")}</span>
|
||||
<span class="text-sm font-mono">{@version}</span>
|
||||
</div>
|
||||
<%= if @aprs_library_sha do %>
|
||||
<div class="flex items-center">
|
||||
<span class="text-sm font-medium opacity-70 mr-2">
|
||||
{gettext("APRS Library:")}
|
||||
</span>
|
||||
<span class="text-sm font-mono">
|
||||
<a
|
||||
href={"https://github.com/aprsme/aprs/commit/#{@aprs_library_sha}"}
|
||||
target="_blank"
|
||||
class="link link-primary"
|
||||
>
|
||||
{@aprs_library_sha}
|
||||
</a>
|
||||
<%= if @is_latest_aprs_library do %>
|
||||
<span class="ml-2 text-success font-semibold">Latest ✅</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -295,10 +274,6 @@ defmodule AprsmeWeb.StatusLive.Index do
|
|||
:aprsme |> Application.spec(:vsn) |> List.to_string()
|
||||
end
|
||||
|
||||
defp get_aprs_library_sha do
|
||||
Aprsme.DependencyInfo.get_aprs_library_sha()
|
||||
end
|
||||
|
||||
defp refresh_status(socket) do
|
||||
aprs_status = get_aprs_status()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue