Skip to content

Commit

Permalink
Adds tini to images
Browse files Browse the repository at this point in the history
  • Loading branch information
rfrey-splunk committed Jan 10, 2024
1 parent a5c2fc3 commit 3f89ce7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions roles/docker_image_build/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ubuntu_tag: latest

timezone: UTC

tini_version: v0.19.0

splunk_home: /opt/splunk
splunk_user: splunk
splunk_user_id: 8089
Expand Down
9 changes: 7 additions & 2 deletions roles/docker_image_build/templates/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ RUN ln -fs /usr/share/zoneinfo/{{ timezone }} /etc/localtime \
&& apt-get install -y --no-install-recommends wget ca-certificates {{ apt_packages|join(' ') }} \
&& apt-get clean

# Add tini as an init to fix signal forwarding when using a bash script as the entrypoint
ENV TINI_VERSION {{ tini_version }}
ADD https://github.com/krallin/tini/releases/download/${{ tini_version }}/tini /tini
RUN chmod +x /tini

{% if install_splunk %}
# change user prior to untarring splunk
USER {{ splunk_user_id }}:{{ splunk_group_id }}
Expand Down Expand Up @@ -40,7 +45,7 @@ COPY {% if 'owner' in copy_path_config %}--chown={{ copy_path_config.owner }}{%
{% endfor %}

{% if run_commands %}
# configurable RUN commands are called after file copies so they can use the copied fils
# configurable RUN commands are called after file copies so they can use the copied files
{% for run_command in run_commands %}
{% if 'user' in run_command %}
USER {{ run_command.user }}{% if 'group' in run_command %}:{{ run_command.group }}{% endif %}
Expand All @@ -66,7 +71,7 @@ RUN {{ splunk_home }}/bin/splunk btool check
{% endif %}

# entrypoint.sh may do run-time configurations prior to starting splunk
ENTRYPOINT {{ entrypoint }}
ENTRYPOINT [ "/tini", "--", {{ entrypoint | tojson | join(', ') }} ]

{% if healthcheck_command %}
HEALTHCHECK \
Expand Down

0 comments on commit 3f89ce7

Please sign in to comment.