Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with main Recruitee/mix_docker #1

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d53c064
Support umbrella apps with default distillery config
lpil Feb 12, 2017
b688ef4
Allow docker image version to be customized
tlvenn Mar 10, 2017
b883c88
Use simple String replacements instead of Code.eval_string
tlvenn Mar 11, 2017
2101e86
Properly test if the project is in git already
tlvenn Mar 12, 2017
65a8b82
Filter the args passed down to docker build.
tlvenn Mar 13, 2017
14b3117
Merge pull request #16 from tlvenn/custom_version
teamon Apr 4, 2017
5e49ed7
Merge pull request #15 from lpil/support-umbrella
teamon Apr 4, 2017
dbb638f
Finally use local repo in tests
teamon Apr 4, 2017
1135f93
Update to erlang 19.2 & elixir 1.4.1
teamon Apr 4, 2017
c673f01
Note about erlang/elixir versions
teamon Apr 4, 2017
30c3052
CLI help
teamon Apr 4, 2017
865079a
Redesigned version/tag setting
teamon Apr 4, 2017
d034422
v0.4.0
teamon Apr 4, 2017
1707b33
Update elixir to 1.4.2
teamon Apr 4, 2017
a784393
v0.4.1
teamon Apr 4, 2017
6474c6d
README update
teamon Apr 4, 2017
0ab178f
Add {rel-version} variable, updated distillery
teamon Apr 4, 2017
004e329
Move test-app under test/
teamon Apr 4, 2017
4afa27e
test-umbrella app
teamon Apr 4, 2017
f5c504f
Support for default release version
teamon Apr 4, 2017
4266a81
Update distillery (fixed compilation for ex 1.3)
teamon Apr 6, 2017
fe1471a
Fixes markdown examples on README.md
pragmaticivan Apr 5, 2017
13454fb
Fix publish arguments
teamon Apr 6, 2017
e0c2a63
v0.4.2
teamon Apr 6, 2017
895b729
Custom length {git_sha}
tlvenn Apr 7, 2017
b18ecc8
Add documentation
tlvenn Apr 7, 2017
4f04bdd
Update to Erlang 19.3
tlvenn Apr 12, 2017
284e5b8
Update distillery
teamon Apr 13, 2017
4671a97
Merge pull request #26 from tlvenn/erlang-19.3
teamon Apr 13, 2017
4fc33d0
Merge pull request #24 from tlvenn/custom_sha
teamon Apr 13, 2017
8d05205
Can run with custom Mix.env, not just prod.
cstar Apr 26, 2017
d393e1d
Merge pull request #30 from cstar/master
teamon Apr 27, 2017
fcf8122
change recomended version in README
CrowdHailer May 24, 2017
bec4318
Merge pull request #39 from CrowdHailer/patch-1
teamon May 24, 2017
e5e540e
Revert "Can run with custom Mix.env, not just prod."
teamon Jun 23, 2017
e10bd90
Update to erlang 1.9.4 & elixir 1.4.4
teamon Jun 23, 2017
88aa10f
v0.5.0
teamon Jun 23, 2017
afcce2f
Update README.md
teamon Jun 7, 2018
af31cb1
Merge pull request #58 from teamon/patch-1
Jun 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Filter the args passed down to docker build.
Given the args are passed down to docker build and that Docker emits an error on a arg it does not know, we need to filter out our own args to keep Docker happy.
tlvenn committed Mar 13, 2017
commit 65a8b82c3ac80b916a00a42e7f7105abf7d762fa
25 changes: 21 additions & 4 deletions lib/mix_docker.ex
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ defmodule MixDocker do

def build(args) do
with_dockerfile @dockerfile_build, fn ->
docker :build, @dockerfile_build, image(:build), args
docker :build, @dockerfile_build, image(:build), docker_build_args(args)
end

Mix.shell.info "Docker image #{image(:build)} has been successfully created"
@@ -43,7 +43,7 @@ defmodule MixDocker do
end

def publish(args) do
name = image(version: image_version(args))
name = image(version: image_version(mix_args(args)))

docker :tag, image(:release), name
docker :push, name
@@ -100,11 +100,28 @@ defmodule MixDocker do
end
defp image_tag(tag), do: tag

defp image_version(args) do
OptionParser.parse(args) |> elem(0) |> Keyword.get(:version)
defp image_version(mix_args) do
mix_args |> Keyword.get(:version)
|| Application.get_env(:mix_docker, :version)
|| "$mix_version.$git_count-$git_sha"
end

@valid_args [:version]
defp mix_args(args) do
parse_args(args)
|> Keyword.take(@valid_args)
end

defp docker_build_args(args) do
parse_args(args)
|> Keyword.drop(@valid_args)
|> OptionParser.to_argv
end

defp parse_args(args) do
{parsed, [], []} = OptionParser.parse(args, switches: [label: :keep], allow_nonexistent_atoms: true)
parsed
end

defp docker(:cp, cid, source, dest) do
system! "docker", ["cp", "#{cid}:#{source}", dest]