diff --git a/conductr_cli/bndl_create.py b/conductr_cli/bndl_create.py
index e5f3cf7..edb06b9 100644
--- a/conductr_cli/bndl_create.py
+++ b/conductr_cli/bndl_create.py
@@ -55,6 +55,7 @@ def bndl_create(args):
     mtime = None
     bundle_conf_data = b''
     runtime_conf_data = b''
+    runtime_conf_str = ''
 
     try:
         process_oci = False
@@ -156,19 +157,17 @@ def bndl_create(args):
 
             runtime_conf_path = os.path.join(input_dir, 'runtime-config.sh')
 
-            runtime_conf_str = ''
-
             if os.path.exists(runtime_conf_path):
                 with open(runtime_conf_path, 'r') as runtime_conf_fileobj:
                     runtime_conf_str = runtime_conf_fileobj.read()
 
-            for env in args.envs if hasattr(args, 'envs') else []:
-                if runtime_conf_str:
-                    runtime_conf_str += '\n'
-                runtime_conf_str += 'export \'{}\''.format(env.replace('\'', ''))
-
+        for env in args.envs if hasattr(args, 'envs') else []:
             if runtime_conf_str:
-                runtime_conf_data = runtime_conf_str.encode('UTF-8')
+                runtime_conf_str += '\n'
+            runtime_conf_str += 'export \'{}\''.format(env.replace('\'', ''))
+
+        if runtime_conf_str:
+            runtime_conf_data = runtime_conf_str.encode('UTF-8')
 
         if not args.name:
                 try:

`bndl` `runtime-config.sh` manipulation broken for non-conductr bundles
The code for `runtime-config.sh` was placed in the wrong spot and only works for input types of `bundle` currently. Needs fix to ensure that `docker`, `oci-image`, `oci-bundle` inputs can also specifiy `--env` flags. Note that this doesn't apply to `conduct load --env` flags which operate correctly due to the input in that case being `bundle` (a configuration bundle)
diff --git a/conductr_cli/test/test_bndl_create.py b/conductr_cli/test/test_bndl_create.py
index c477a36..9cdb5df 100644
--- a/conductr_cli/test/test_bndl_create.py
+++ b/conductr_cli/test/test_bndl_create.py
@@ -623,3 +623,52 @@ class TestBndlCreate(CliTestCase):
                     self.assertTrue(saw_config)
         finally:
             shutil.rmtree(temp_dir)
+
+    def test_oci_env(self):
+        stdout_mock = MagicMock()
+        tmpdir = tempfile.mkdtemp()
+        tmpfile = os.path.join(tmpdir, 'output')
+
+        try:
+            attributes = create_attributes_object({
+                'name': 'test',
+                'source': tmpdir,
+                'format': 'oci-image',
+                'image_tag': 'latest',
+                'output': tmpfile,
+                'component_description': '',
+                'use_shazar': True,
+                'use_default_endpoints': True,
+                'annotations': [],
+                'envs': [
+                    'ENV1=123',
+                    'ENV2=456'
+                ]
+            })
+
+            os.mkdir(os.path.join(tmpdir, 'refs'))
+            open(os.path.join(tmpdir, 'oci-layout'), 'w').close()
+            refs = open(os.path.join(tmpdir, 'refs/latest'), 'w')
+            refs.write('{}')
+            refs.close()
+
+            with \
+                    patch('sys.stdin', MagicMock(**{'buffer': BytesIO(b'')})), \
+                    patch('sys.stdout.buffer.write', stdout_mock):
+                self.assertEqual(bndl_create.bndl_create(attributes), 0)
+
+            self.assertTrue(zipfile.is_zipfile(tmpfile))
+
+            files = {}
+
+            with zipfile.ZipFile(tmpfile) as zip:
+                infos = zip.infolist()
+                for info in infos:
+                    files[info.filename] = zip.read(info.filename)
+
+            self.assertEqual(
+                files['test/runtime-config.sh'],
+                b'export \'ENV1=123\'\nexport \'ENV2=456\''
+            )
+        finally:
+            shutil.rmtree(tmpdir)

pip install -e .
parse_log_pytest
pytest
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
argcomplete==3.6.1
arrow==1.3.0
certifi==2025.1.31
charset-normalizer==3.4.1
colorama==0.4.6
-e git+https://github.com/typesafehub/conductr-cli.git@d6fafba900ac59074dd36f96c7c2221c9f46aef9#egg=conductr_cli
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
execnet==2.1.1
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
jsonschema==2.6.0
packaging @ file:///croot/packaging_1734472117206/work
pager==3.3
pluggy @ file:///croot/pluggy_1733169602837/work
prettytable==0.7.2
psutil==5.9.8
Pygments==2.19.1
pyhocon==0.3.35
PyJWT==1.4.2
pyparsing==3.2.3
pyreadline==2.1
pytest @ file:///croot/pytest_1738938843180/work
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
requests==2.32.3
requests-toolbelt==1.0.0
six==1.17.0
sseclient==0.0.14
toml==0.10.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
urllib3==2.3.0
www-authenticate==0.9.2

name: conductr-cli
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argcomplete==3.6.1
      - arrow==1.3.0
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - colorama==0.4.6
      - coverage==7.8.0
      - execnet==2.1.1
      - idna==3.10
      - jsonschema==2.6.0
      - pager==3.3
      - prettytable==0.7.2
      - psutil==5.9.8
      - pygments==2.19.1
      - pyhocon==0.3.35
      - pyjwt==1.4.2
      - pyparsing==3.2.3
      - pyreadline==2.1
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - python-dateutil==2.9.0.post0
      - requests==2.32.3
      - requests-toolbelt==1.0.0
      - six==1.17.0
      - sseclient==0.0.14
      - toml==0.10.2
      - types-python-dateutil==2.9.0.20241206
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - www-authenticate==0.9.2
prefix: /opt/conda/envs/conductr-cli

conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_oci_env
conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_mtime_from_config
conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_arg_no_name conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_conf conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_conf_dir conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_conf_no_name conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_envs conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_bundle_envs_append conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_deterministic_with_shazar conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_deterministic_without_shazar conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_no_format conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_no_ref conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_not_oci conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_with_shazar conductr_cli/test/test_bndl_create.py::TestBndlCreate::test_without_shazar
conductr_cli/bndl_create.py
conductr_cli/bndl_create.py