mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-03-22 02:29:08 +00:00
podman_image: add file parameter for Containerfile location (#492)
* `podman_image`: correct `path` parameter description The `path` parameter is the last parameter when running `podman build ...`. As specified in the manpage, it is defined as the build context, and not necessarily should it contain the Containerfile. Signed-off-by: Yuriy Gabuev <yuriy.gabuev@holoplot.com> * `podman_image`: add `file` parameter for Containerfile location Add the `file` parameter to `podman_image` module which mirrors the `--file` command line argument for `podman build ...`. This parameter specifies the location of the Containerfile to use in case it should be different from the one contained in the build context directory. Signed-off-by: Yuriy Gabuev <yuriy.gabuev@holoplot.com> * `podman_image`: add integration tests for `file` parameter Add tests to ensure that: - building from a directory without a Containerfile (or Dockerfile) fails - specifying the location of Containerfile with `file` parameter works Signed-off-by: Yuriy Gabuev <yuriy.gabuev@holoplot.com> Signed-off-by: Yuriy Gabuev <yuriy.gabuev@holoplot.com>
This commit is contained in:
parent
9531d15d24
commit
dbdac4a52b
2 changed files with 44 additions and 6 deletions
|
|
@ -43,7 +43,7 @@ DOCUMENTATION = r'''
|
|||
default: False
|
||||
type: bool
|
||||
path:
|
||||
description: Path to directory containing the build file.
|
||||
description: Path to the build context directory.
|
||||
type: str
|
||||
force:
|
||||
description:
|
||||
|
|
@ -88,6 +88,10 @@ DOCUMENTATION = r'''
|
|||
- build_args
|
||||
- buildargs
|
||||
suboptions:
|
||||
file:
|
||||
description:
|
||||
- Path to the Containerfile if it is not in the build context directory.
|
||||
type: path
|
||||
volume:
|
||||
description:
|
||||
- Specify multiple volume / mount options to mount one or more mounts to a container.
|
||||
|
|
@ -606,6 +610,10 @@ class PodmanImageManager(object):
|
|||
if self.build.get('rm'):
|
||||
args.append('--rm')
|
||||
|
||||
containerfile = self.build.get('file')
|
||||
if containerfile:
|
||||
args.extend(['--file', containerfile])
|
||||
|
||||
volume = self.build.get('volume')
|
||||
if volume:
|
||||
for v in volume:
|
||||
|
|
@ -767,6 +775,7 @@ def main():
|
|||
options=dict(
|
||||
annotation=dict(type='dict'),
|
||||
force_rm=dict(type='bool', default=False),
|
||||
file=dict(type='path'),
|
||||
format=dict(
|
||||
type='str',
|
||||
choices=['oci', 'docker'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue