Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bci_build/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ class BaseContainerImage(abc.ABC):
# The user to use for entrypoint service
entrypoint_user: str | None = ""

# An optional workdir for the entrypoint or CMD
workdir: str | None = ""

#: An optional CMD for the image, it is omitted if empty or ``None``
cmd: list[str] | None = None

Expand Down
4 changes: 4 additions & 0 deletions src/bci_build/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
{%- if image.expose_dockerfile %}{{ image.expose_dockerfile }}{% endif %}
{% if image.dockerfile_custom_end %}{{ image.dockerfile_custom_end }}{% endif %}
{%- if image.entrypoint_user %}USER {{ image.entrypoint_user }}{% endif %}
{%- if image.workdir %}WORKDIR {{ image.workdir }}{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently we embed "WORKDIR" into "dockerfile_custom_end" which is a bit earlier in the order of Dockerfile statements than the new one you add here.

could you please convert the existing users (or at least one of them) over to the new attribute (e.g. src/bci_build/package/php.py and others) so that we can see that it works the same way? alternatively extend tests/test_build_recipe to have workdir defined also somewhere.

{%- if image.volume_dockerfile %}{{ image.volume_dockerfile }}{% endif %}
"""
)
Expand Down Expand Up @@ -137,6 +138,9 @@
{%- if image.entrypoint_user %}
user="{{ image.entrypoint_user }}"
{%- endif %}
{%- if image.workdir %}
workingdir="{{ image.workdir }}"
{%- endif %}
{#- NOTE: eye sight chart: this has a closing element character '>' here: ----> -#} >
<labels>
<suse_label_helper:add_prefix prefix="{{ image.labelprefix }}">
Expand Down
Loading