Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Open
Changes from all commits
Commits
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
15 changes: 14 additions & 1 deletion lib/docker-compose/models/compose_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ def prepare_image
end
elsif @attributes.key?(:build)
@internal_image = SecureRandom.hex # Random name for image
Docker::Image.build_from_dir(@attributes[:build], {t: @internal_image})
opts = {t: @internal_image}
Copy link
Owner

@mauricioklein mauricioklein Dec 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a spec for this scenario?


# docker-api can't figure out context directive
# We need to convert it to path instead
if @attributes[:build].is_a? Hash
dir = @attributes[:build]['context']

# Use all other opts as is but remove context
opts.merge!(@attributes[:build]).delete('context')
end

dir ||= @attributes[:build]

Docker::Image.build_from_dir(dir, opts)
end
end

Expand Down