fix parser version check
This commit is contained in:
parent
cfdaf954d5
commit
6cebd03d7f
2 changed files with 20 additions and 5 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 parser git hash environment variable for runtime
|
# Set default parser git hash environment variable
|
||||||
ENV PARSER_GIT_HASH=$(cat /app/parser_hash.txt)
|
ENV PARSER_GIT_HASH="unknown"
|
||||||
|
|
||||||
# Copy release from builder
|
# Copy release from builder
|
||||||
COPY --from=builder --chown=nobody:root /app/release ./
|
COPY --from=builder --chown=nobody:root /app/release ./
|
||||||
|
|
|
||||||
|
|
@ -55,9 +55,24 @@ defmodule Aprsme.DependencyInfo do
|
||||||
# Get static parser hash at compile time
|
# Get static parser hash at compile time
|
||||||
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 -> "unknown"
|
nil ->
|
||||||
"unknown" -> "unknown"
|
"unknown"
|
||||||
hash -> hash
|
|
||||||
|
"unknown" ->
|
||||||
|
# Try to read from the file copied during build
|
||||||
|
hash_file = Path.join(["/app", "parser_hash.txt"])
|
||||||
|
|
||||||
|
if File.exists?(hash_file) do
|
||||||
|
case File.read(hash_file) do
|
||||||
|
{:ok, hash} -> String.trim(hash)
|
||||||
|
_ -> "unknown"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
"unknown"
|
||||||
|
end
|
||||||
|
|
||||||
|
hash ->
|
||||||
|
hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue