Packages

Installs a docker development environment into your project.

Current section

Files

Jump to
dockerize_elixir lib mix tasks dockerize.ex
Raw

lib/mix/tasks/dockerize.ex

defmodule Mix.Tasks.Dockerize do
use Mix.Task
def run([path]) when is_binary(path) do
absolute_path = Path.expand(path)
cond do
!File.exists?(absolute_path) ->
IO.puts("Error: path \"#{path}\" does not exist!")
!File.dir?(absolute_path) ->
IO.puts("Error: path \"#{path}\" is not a directory!")
!File.exists?(Path.join(absolute_path, "mix.exs")) ->
IO.puts("Error: path \"#{path}\" is not a mix project!")
true ->
DockerizeElixir.dockerize(absolute_path)
end
end
def run(_) do
IO.puts("Usage: mix dockerize path")
end
end