Class: Vtasks::Docker::Image
- Inherits:
-
Object
- Object
- Vtasks::Docker::Image
- Includes:
- Utils::Git, Utils::Semver
- Defined in:
- lib/vtasks/docker/image.rb,
lib/vtasks/docker/image/tag.rb,
lib/vtasks/docker/image/push.rb,
lib/vtasks/docker/image/build.rb
Overview
Docker Image class
Defined Under Namespace
Constant Summary
Constants included from Utils::Semver
Constants included from Utils::Git
Instance Attribute Summary collapse
-
#has_build_args ⇒ Object
readonly
Returns the value of attribute has_build_args.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#build ⇒ Object
Build image.
-
#build_date ⇒ Object
Compose build date.
-
#build_tag ⇒ Object
Compose build tag.
-
#build_with_tags ⇒ Object
Build image with tags.
-
#initialize(image, path, args = {}) ⇒ Image
constructor
A new instance of Image.
-
#push ⇒ Object
Push image.
-
#tag ⇒ Object
Tag image.
Methods included from Utils::Semver
Methods included from Utils::Git
#git_branch, #git_ci_status, #git_clean_repo, #git_commit, #git_deepen_repo, #git_url
Constructor Details
#initialize(image, path, args = {}) ⇒ Image
Returns a new instance of Image.
18 19 20 21 22 |
# File 'lib/vtasks/docker/image.rb', line 18 def initialize(image, path, args = {}) @image ||= image @path ||= path @has_build_args ||= args.fetch(:has_build_args, false) end |
Instance Attribute Details
#has_build_args ⇒ Object (readonly)
Returns the value of attribute has_build_args.
16 17 18 |
# File 'lib/vtasks/docker/image.rb', line 16 def has_build_args @has_build_args end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
16 17 18 |
# File 'lib/vtasks/docker/image.rb', line 16 def image @image end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
16 17 18 |
# File 'lib/vtasks/docker/image.rb', line 16 def path @path end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
16 17 18 |
# File 'lib/vtasks/docker/image.rb', line 16 def @tags end |
Instance Method Details
#build ⇒ Object
Build image
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vtasks/docker/image.rb', line 49 def build args = { build_date: build_date, build_tag: build_tag } build = Vtasks::Docker::Image::Build.new(image, path, args) if has_build_args build.with_arguments else build.without_arguments end end |
#build_date ⇒ Object
Compose build date
39 40 41 |
# File 'lib/vtasks/docker/image.rb', line 39 def build_date @build_date ||= ::Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ') end |
#build_tag ⇒ Object
Compose build tag
44 45 46 |
# File 'lib/vtasks/docker/image.rb', line 44 def build_tag @build_tag ||= gitver.to_s end |
#build_with_tags ⇒ Object
Build image with tags
70 71 72 73 |
# File 'lib/vtasks/docker/image.rb', line 70 def build tag end |