37 lines
722 B
Elixir
37 lines
722 B
Elixir
defmodule Mix.Tasks.Deploy do
|
|
use Mix.Task
|
|
|
|
@moduledoc """
|
|
Deploy this application to production.
|
|
"""
|
|
|
|
@shortdoc "deploy to production"
|
|
|
|
@spec run([...]) :: any
|
|
def run([host]) do
|
|
System.cmd(
|
|
"rsync",
|
|
[
|
|
"--archive",
|
|
"--delete",
|
|
"--compress",
|
|
"--human-readable",
|
|
"--progress",
|
|
"--stats",
|
|
"--verbose",
|
|
"--exclude-from=.gitignore",
|
|
"--exclude=.git/",
|
|
"./",
|
|
"#{host}:chronoscope/"
|
|
],
|
|
into: IO.stream()
|
|
)
|
|
|
|
System.cmd(
|
|
"ssh",
|
|
[host, "cd chronoscope && buildah build -t chronoscope:latest && podman auto-update && podman image prune -f"],
|
|
into: IO.stream()
|
|
)
|
|
end
|
|
end
|