mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 04:18:42 +00:00
Fix docker_image's build.args (#456)
* Add tests for build.args. * Fix bug: store build args in correct dict * Add changelog fragment. * Update copyright notice.
This commit is contained in:
parent
ad05773e34
commit
d8297df7d0
2
changelogs/fragments/456-docker_image-build-args.yml
Normal file
2
changelogs/fragments/456-docker_image-build-args.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- "docker_image - fix build argument handling (https://github.com/ansible-collections/community.docker/issues/455, https://github.com/ansible-collections/community.docker/pull/456)."
|
||||||
@ -696,7 +696,7 @@ class ImageManager(DockerBaseClass):
|
|||||||
buildargs = {}
|
buildargs = {}
|
||||||
if self.buildargs:
|
if self.buildargs:
|
||||||
for key, value in self.buildargs.items():
|
for key, value in self.buildargs.items():
|
||||||
self.buildargs[key] = to_native(value)
|
buildargs[key] = to_native(value)
|
||||||
|
|
||||||
container_limits = self.container_limits or {}
|
container_limits = self.container_limits or {}
|
||||||
for key in container_limits.keys():
|
for key in container_limits.keys():
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
src: '{{ item }}'
|
src: '{{ item }}'
|
||||||
dest: '{{ remote_tmp_dir }}/files/{{ item }}'
|
dest: '{{ remote_tmp_dir }}/files/{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
|
- ArgsDockerfile
|
||||||
- Dockerfile
|
- Dockerfile
|
||||||
- EtcHostsDockerfile
|
- EtcHostsDockerfile
|
||||||
- MyDockerfile
|
- MyDockerfile
|
||||||
|
|||||||
@ -27,7 +27,9 @@
|
|||||||
name: "{{ iname }}"
|
name: "{{ iname }}"
|
||||||
build:
|
build:
|
||||||
path: "{{ remote_tmp_dir }}/files"
|
path: "{{ remote_tmp_dir }}/files"
|
||||||
|
dockerfile: "ArgsDockerfile"
|
||||||
args:
|
args:
|
||||||
|
IMAGE: "{{ docker_test_image_busybox }}"
|
||||||
TEST1: val1
|
TEST1: val1
|
||||||
TEST2: val2
|
TEST2: val2
|
||||||
TEST3: "True"
|
TEST3: "True"
|
||||||
@ -41,7 +43,9 @@
|
|||||||
name: "{{ iname }}"
|
name: "{{ iname }}"
|
||||||
build:
|
build:
|
||||||
path: "{{ remote_tmp_dir }}/files"
|
path: "{{ remote_tmp_dir }}/files"
|
||||||
|
dockerfile: "ArgsDockerfile"
|
||||||
args:
|
args:
|
||||||
|
IMAGE: "{{ docker_test_image_busybox }}"
|
||||||
TEST1: val1
|
TEST1: val1
|
||||||
TEST2: val2
|
TEST2: val2
|
||||||
TEST3: "True"
|
TEST3: "True"
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
# Copyright (c) 2022, Felix Fontein
|
||||||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
ARG IMAGE
|
||||||
|
ARG TEST1
|
||||||
|
ARG TEST2
|
||||||
|
ARG TEST3
|
||||||
|
|
||||||
|
FROM ${IMAGE}
|
||||||
|
ENV foo /bar
|
||||||
|
WORKDIR ${foo}
|
||||||
|
RUN echo "${TEST1} - ${TEST2} - ${TEST3}"
|
||||||
Loading…
Reference in New Issue
Block a user