fix parser version check
This commit is contained in:
parent
10159f7ba7
commit
2c8b594d59
2 changed files with 10 additions and 20 deletions
|
|
@ -67,8 +67,8 @@ RUN date -u +"%Y-%m-%dT%H:%M:%SZ" > /app/deployed_at.txt
|
||||||
# Copy parser hash from builder stage
|
# Copy parser hash from builder stage
|
||||||
COPY --from=builder /tmp/parser_hash.txt /app/parser_hash.txt
|
COPY --from=builder /tmp/parser_hash.txt /app/parser_hash.txt
|
||||||
|
|
||||||
# Set default parser git hash environment variable
|
# Set parser git hash environment variable for runtime
|
||||||
ENV PARSER_GIT_HASH="unknown"
|
RUN PARSER_HASH=$(cat /app/parser_hash.txt) && echo "PARSER_GIT_HASH=$PARSER_HASH" >> /etc/environment
|
||||||
|
|
||||||
# Copy release from builder
|
# Copy release from builder
|
||||||
COPY --from=builder --chown=nobody:root /app/release ./
|
COPY --from=builder --chown=nobody:root /app/release ./
|
||||||
|
|
|
||||||
|
|
@ -47,27 +47,17 @@ defmodule Aprsme.DependencyInfo do
|
||||||
defp get_static_parser_hash do
|
defp get_static_parser_hash do
|
||||||
case System.get_env("PARSER_GIT_HASH") do
|
case System.get_env("PARSER_GIT_HASH") do
|
||||||
nil ->
|
nil ->
|
||||||
"unknown"
|
# Fallback: try to read from the file
|
||||||
|
|
||||||
"unknown" ->
|
|
||||||
# Try to read from the file copied during build
|
|
||||||
hash_file = Path.join(["/app", "parser_hash.txt"])
|
hash_file = Path.join(["/app", "parser_hash.txt"])
|
||||||
|
|
||||||
# Try alternative paths
|
if File.exists?(hash_file) do
|
||||||
alternative_paths = [
|
case File.read(hash_file) do
|
||||||
hash_file,
|
{:ok, hash} -> String.trim(hash)
|
||||||
Path.join([File.cwd!(), "parser_hash.txt"]),
|
_ -> "unknown"
|
||||||
"parser_hash.txt"
|
|
||||||
]
|
|
||||||
|
|
||||||
Enum.find_value(alternative_paths, "unknown", fn path ->
|
|
||||||
if File.exists?(path) do
|
|
||||||
case File.read(path) do
|
|
||||||
{:ok, hash} -> String.trim(hash)
|
|
||||||
_ -> nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
else
|
||||||
|
"unknown"
|
||||||
|
end
|
||||||
|
|
||||||
hash ->
|
hash ->
|
||||||
hash
|
hash
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue