FIXES #440: absolute secret

This commit is contained in:
Muayyad alsadi 2022-02-28 01:19:07 +03:00
parent 2d1bcddf09
commit af10345483
2 changed files with 9 additions and 1 deletions

View File

@ -445,9 +445,11 @@ def get_secret_args(compose, cnt, secret):
dest_file = f'/run/secrets/{secret_name}'
elif not target.startswith("/"):
sec = target if target else secret_name
dest_file = f's/run/secrets/{sec}'
dest_file = f'/run/secrets/{sec}'
else:
dest_file = target
basedir = compose.dirname
source_file = os.path.realpath(os.path.join(basedir, os.path.expanduser(source_file)))
volume_ref = [
'--volume', f'{source_file}:{dest_file}:ro,rprivate,rbind'
]
@ -921,6 +923,8 @@ class Podman:
return volumes
def normalize_service(service, sub_dir=''):
# make `build.context` relative to sub_dir
# TODO: should we make volume and secret relative too?
if sub_dir and 'build' in service:
build = service['build']
context = build if is_str(build) else build.get('context', None)

View File

@ -1,3 +1,7 @@
---
# echo "sec" | podman secret create my_secret -
# echo "sec2" | podman secret create my_secret_2 -
# echo "sec3" | podman secret create my_secret_3 -
version: "3.8"
services:
test: