Use docker info to get arch
This commit is contained in:
@@ -29,9 +29,7 @@ class Kamal::Configuration::Builder
|
|||||||
|
|
||||||
def local_arches
|
def local_arches
|
||||||
@local_arches ||= if remote
|
@local_arches ||= if remote
|
||||||
uname_m = `uname -m`.strip
|
arches & [ Kamal::Utils.docker_arch ]
|
||||||
local_arch = uname_m == "x86_64" ? "amd64" : uname_m
|
|
||||||
arches & [ local_arch ]
|
|
||||||
else
|
else
|
||||||
arches
|
arches
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -81,4 +81,16 @@ module Kamal::Utils
|
|||||||
def join_commands(commands)
|
def join_commands(commands)
|
||||||
commands.map(&:strip).join(" ")
|
commands.map(&:strip).join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def docker_arch
|
||||||
|
arch = `docker info --format '{{.Architecture}}'`.strip
|
||||||
|
case arch
|
||||||
|
when /aarch64/
|
||||||
|
"arm64"
|
||||||
|
when /x86_64/
|
||||||
|
"amd64"
|
||||||
|
else
|
||||||
|
arch
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -145,10 +145,10 @@ class CommandsBuilderTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def local_arch
|
def local_arch
|
||||||
`uname -m`.strip == "x86_64" ? "amd64" : "arm64"
|
Kamal::Utils.docker_arch
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_arch
|
def remote_arch
|
||||||
`uname -m`.strip == "x86_64" ? "arm64" : "amd64"
|
Kamal::Utils.docker_arch == "arm64" ? "amd64" : "arm64"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
2
test/fixtures/deploy_with_remote_builder.yml
vendored
2
test/fixtures/deploy_with_remote_builder.yml
vendored
@@ -38,5 +38,5 @@ builder:
|
|||||||
readiness_delay: 0
|
readiness_delay: 0
|
||||||
|
|
||||||
builder:
|
builder:
|
||||||
arch: <%= `uname -m`.strip == "x86_64" ? "arm64" : "amd64" %>
|
arch: <%= Kamal::Utils.docker_arch == "arm64" ? "amd64" : "arm64" %>
|
||||||
remote: ssh://app@1.1.1.5
|
remote: ssh://app@1.1.1.5
|
||||||
|
|||||||
@@ -42,5 +42,5 @@ ssh:
|
|||||||
port: 22
|
port: 22
|
||||||
|
|
||||||
builder:
|
builder:
|
||||||
arch: <%= `uname -m`.strip == "x86_64" ? "arm64" : "amd64" %>
|
arch: <%= Kamal::Utils.docker_arch == "arm64" ? "amd64" : "arm64" %>
|
||||||
remote: ssh://app@1.1.1.5:2122
|
remote: ssh://app@1.1.1.5:2122
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ registry:
|
|||||||
password: root
|
password: root
|
||||||
builder:
|
builder:
|
||||||
driver: docker
|
driver: docker
|
||||||
arch: <%= uname_m = `uname -m`; uname_m == "x86_64" ? "amd64" : uname_m %>
|
arch: <%= Kamal::Utils.docker_arch %>
|
||||||
args:
|
args:
|
||||||
COMMIT_SHA: <%= `git rev-parse HEAD` %>
|
COMMIT_SHA: <%= `git rev-parse HEAD` %>
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ registry:
|
|||||||
password: root
|
password: root
|
||||||
builder:
|
builder:
|
||||||
driver: docker
|
driver: docker
|
||||||
arch: <%= uname_m = `uname -m`; uname_m == "x86_64" ? "amd64" : uname_m %>
|
arch: <%= Kamal::Utils.docker_arch %>
|
||||||
args:
|
args:
|
||||||
COMMIT_SHA: <%= `git rev-parse HEAD` %>
|
COMMIT_SHA: <%= `git rev-parse HEAD` %>
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
Reference in New Issue
Block a user