Skip to content

Commit

Permalink
Handle more varied forms of src tree
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Nov 26, 2024
1 parent a462c85 commit ecb577f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tasks/docker.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ namespace :docker do
dockerfile = f
context = File.dirname(dockerfile)

image = "#{repository}/#{File.dirname(f.sub(/^src\//, "").sub(/\/Dockerfile(.*)/, ""))}"
tag = f.sub(/.*\/(\d+(?:\.\d+))+\//, "\\1").sub(/Dockerfile(.*)$/) { |m| m.sub("Dockerfile", "").tr(".", "-") }
if (m = context.match(/\/((?:v?)\d+(?:\.\d+|$)+)$/))
tag = m[1] + File.basename(dockerfile).sub(/Dockerfile(?:.*)$/) { |m| m.sub("Dockerfile", "").tr(".", "-") }
image = "#{repository}/#{File.dirname(context).sub(/^src\//, "")}"
else
tag = "latest"
image = "#{repository}/#{context.sub(/^src\//, "")}".sub(/Dockerfile(?:.*)$/) { |m| m.sub("Dockerfile", "").tr(".", "-") }
end

targets = [
{
Expand Down

0 comments on commit ecb577f

Please sign in to comment.