Packages

Library for building docker images of Elixir projects. Supports a plugin system which can allows the generated Dockerfile to be extended at various points.

Current section

Files

Jump to
docker_build lib docker_build code.ex
Raw

lib/docker_build/code.ex

defmodule DockerBuild.Code do
@moduledoc "Loads extra source code"
def require_all(paths) when is_list(paths) do
for path <- paths do
for file <- list_all_files(path) do
Code.require_file(file)
end
end
end
defp list_all_files(filepath) do
expand(File.ls(filepath), filepath)
end
defp expand({:ok, files}, path) do
files
|> Enum.flat_map(&list_all_files("#{path}/#{&1}"))
end
defp expand({:error, _}, path) do
if String.ends_with?(path, ".ex") do
[path]
else
[]
end
end
end