Skip to content

Commit

Permalink
Fix, use "service.build.ulimits" when it is present instead of "servi…
Browse files Browse the repository at this point in the history
…ce.ulimits"
  • Loading branch information
Cam Spiers committed Apr 8, 2024
1 parent 6103df7 commit ed43705
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,7 @@ def mount_desc_to_mount_args(compose, mount_desc, srv_name, cnt_name): # pylint
raise ValueError("unknown mount type:" + mount_type)


def container_to_ulimit_args(cnt, podman_args):
ulimit = cnt.get("ulimits", [])
def ulimit_to_ulimit_args(ulimit, podman_args):
if ulimit is not None:
# ulimit can be a single value, i.e. ulimit: host
if is_str(ulimit):
Expand All @@ -457,6 +456,17 @@ def container_to_ulimit_args(cnt, podman_args):
podman_args.extend(["--ulimit", i])


def container_to_ulimit_args(cnt, podman_args):
ulimit_to_ulimit_args(cnt.get("ulimits", []), podman_args)


def container_to_ulimit_build_args(cnt, podman_args):
build = cnt.get("build", None)

if build is not None:
ulimit_to_ulimit_args(build.get("ulimits", []), podman_args)


def mount_desc_to_volume_args(compose, mount_desc, srv_name, cnt_name): # pylint: disable=unused-argument
mount_type = mount_desc["type"]
if mount_type not in ("bind", "volume"):
Expand Down Expand Up @@ -2166,7 +2176,7 @@ async def build_one(compose, args, cnt):
build_args.extend(["-t", tag])
if "target" in build_desc:
build_args.extend(["--target", build_desc["target"]])
container_to_ulimit_args(cnt, build_args)
container_to_ulimit_build_args(cnt, build_args)
if getattr(args, "no_cache", None):
build_args.append("--no-cache")
if getattr(args, "pull_always", None):
Expand Down

0 comments on commit ed43705

Please sign in to comment.