Packages
graphqexl
0.1.0
0.1.0
0.1.0-alpha-rc.docs-test-6
0.1.0-alpha-rc.docs-test-5
0.1.0-alpha-rc.docs-test-4
0.1.0-alpha-rc.docs-test-3
0.1.0-alpha-rc.docs-test-2
0.1.0-alpha-rc.docs-test
0.1.0-alpha-rc.25
0.1.0-alpha-rc.24
0.1.0-alpha-rc.23
0.1.0-alpha-rc.22
0.1.0-alpha-rc.21
0.1.0-alpha-rc.20
0.1.0-alpha-rc.19
0.1.0-alpha-rc.18
0.1.0-alpha-rc.17
0.1.0-alpha-rc.16
0.1.0-alpha-rc.15
0.1.0-alpha-rc.14
0.1.0-alpha-rc.13
0.1.0-alpha-rc.12
0.1.0-alpha-rc.11
0.1.0-alpha-rc.10
0.1.0-alpha-rc.9
0.1.0-alpha-rc.8
0.1.0-alpha-rc.7
0.1.0-alpha-rc.6
0.1.0-alpha-rc.5
0.1.0-alpha-rc.4
0.1.0-alpha-rc.3
0.1.0-alpha-rc.2
0.1.0-alpha-rc.1
0.1.0-alpha.rc-4
0.1.0-alpha.rc.4
Fully-loaded, pure-Elixir GraphQL server implementation with developer tools
Current section
Files
Jump to
Current section
Files
lib/mix/tasks/docker/publish.ex
defmodule Mix.Tasks.Docker.Publish do
@shortdoc """
Publish the built application container to the given image repo
"""
def run([image_name, image_repo, image_tag]) do
tag = image_tag || "#{git_sha}-dev"
IO.puts "[STARTING] Publishing #{image_repo}/#{image_name}:#{tag}..."
remote = docker_image(image_repo, image_name, tag)
image_name
|> docker_tag(remote)
|> cmd_and(remote |> docker_push)
IO.puts "[DONE] Publishing Docker image..."
end
defp cmd_and(cmd1, cmd2) do
system_run(cmd1) && system_run(cmd2)
end
defp docker_image(name, repo, tag) do
"#{repo}/#{name}:#{tag}"
end
defp local(image_name) do
docker_image(image_name, "local-registry", "latest")
end
defp docker_push(remote) do
IO.puts("[...] Pushing #{remote}")
{"docker", ["push", remote]}
end
defp docker_tag(image_name, remote) do
IO.puts("[...] Tagging #{remote}")
{"docker", ["tag", local(image_name), remote]}
end
defp git_sha do
{sha, status} = System.cmd("git", ["rev-parse", "--short=7", "HEAD"])
sha |> String.trim
end
defp system_run({cmd, args}) do
System.cmd(cmd, args, into: IO.stream(:stdio, :line))
end
end