Fix containerize view symlink issue (#39419)

This commit is contained in:
Harmen Stoppels
2023-08-14 18:02:48 +02:00
committed by GitHub
parent f0ed159a1b
commit a2a52dfb21
3 changed files with 22 additions and 16 deletions

View File

@@ -51,15 +51,17 @@ FROM {{ run.image }}
COPY --from=builder {{ paths.environment }} {{ paths.environment }}
COPY --from=builder {{ paths.store }} {{ paths.store }}
COPY --from=builder {{ paths.hidden_view }} {{ paths.hidden_view }}
COPY --from=builder {{ paths.view }} {{ paths.view }}
# paths.view is a symlink, so copy the parent to avoid dereferencing and duplicating it
COPY --from=builder {{ paths.view_parent }} {{ paths.view_parent }}
RUN { \
echo '#!/bin/sh' \
&& echo '.' {{ paths.environment }}/activate.sh \
&& echo 'exec "$@"'; \
} > /entrypoint.sh \
&& chmod a+x /entrypoint.sh
&& chmod a+x /entrypoint.sh \
&& ln -s {{ paths.view }} {{ paths.former_view }}
{% block final_stage %}

View File

@@ -47,7 +47,7 @@ EOF
{% for application, help_text in apps.items() %}
%apprun {{ application }}
exec /opt/view/bin/{{ application }} "$@"
exec {{ paths.view }}/bin/{{ application }} "$@"
%apphelp {{ application }}
{{help_text }}
@@ -61,11 +61,14 @@ Stage: final
%files from build
{{ paths.environment }} /opt
{{ paths.store }} /opt
{{ paths.hidden_view }} /opt
{{ paths.view }} /opt
{{ paths.view_parent }} /opt
{{ paths.environment }}/environment_modifications.sh {{ paths.environment }}/environment_modifications.sh
%post
# Symlink the old view location
ln -s {{ paths.view }} {{ paths.former_view }}
{% block final_stage %}
{% if os_packages_final.list %}
# Update, install and cleanup of system packages needed at run-time