Packages
mandrag
0.6.0
1.0.0-pre.0
0.8.1
0.8.0
0.7.3
0.7.2
0.7.1
0.7.0
0.6.10
0.6.9
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.1
0.4.0
0.3.3
0.3.2
0.3.1
0.3.0
0.2.4
0.2.1
retired
0.2.0
retired
0.1.1
0.1.0
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Build and Deploy Elixir releases to Kubernetes via Helm
Current section
Files
Jump to
Current section
Files
lib/mandrag.ex
defmodule Mandrag do
@moduledoc """
Documentation for Mandrag.
"""
# Config
def app, do: Application.get_env(:mandrag, :app, Mix.Project.config()[:app])
def docker_repo, do: Application.get_env(:mandrag, :image, "docker/#{name()}")
def docker_build_args do
Map.merge(Application.get_env(:mandrag, :docker_build_args, %{}), %{name: app()})
end
def dockerfile_path do
Application.get_env(
:mandrag,
:dockerfile_path,
Path.join(:code.priv_dir(:mandrag), "Dockerfile")
)
end
def tag, do: Mix.Project.config()[:version]
def ecto_repo, do: Application.get_env(:mandrag, :repo)
# Helpers
def current, do: "#{docker_repo()}:#{tag()}"
def docker(args), do: Mix.Shell.IO.cmd("docker " <> args)
def latest, do: "#{docker_repo()}:latest"
def migrate do
if function_exported?(Ecto.Migrator, :run, 4) do
{:ok, _} = Application.ensure_all_started(app())
path = Application.app_dir(app(), "priv/repo/migrations")
Ecto.Migrator.run(ecto_repo(), path, :up, all: true)
end
end
def name, do: app() |> Atom.to_string()
end