chronoscope/lib/mix/tasks/deploy.ex

33 lines
673 B
Elixir
Raw Normal View History

2024-03-27 09:11:42 -04:00
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"], into: IO.stream())
end
end