build and push Docker image
This commit is contained in:
29
lib/mix/tasks/labelmaker.release.ex
Normal file
29
lib/mix/tasks/labelmaker.release.ex
Normal file
@@ -0,0 +1,29 @@
|
||||
defmodule Mix.Tasks.Labelmaker.Release do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Builds and releases the labelmaker Docker image"
|
||||
|
||||
def run(_args) do
|
||||
cmd = "docker"
|
||||
|
||||
args = [
|
||||
"buildx",
|
||||
"build",
|
||||
"--platform",
|
||||
"linux/amd64",
|
||||
"-t",
|
||||
"192.168.0.2:5000/labelmaker",
|
||||
"--push",
|
||||
"."
|
||||
]
|
||||
|
||||
IO.puts("Running Docker build and push...")
|
||||
|
||||
{_output, exit_code} =
|
||||
System.cmd(cmd, args, into: IO.stream(:stdio, :line), stderr_to_stdout: true)
|
||||
|
||||
if exit_code != 0 do
|
||||
Mix.raise("Docker buildx failed with exit code #{exit_code}")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user