Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds tini to images #63

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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", "-g", "--", {{ entrypoint | tojson | join(', ') }} ]

{% if healthcheck_command %}
HEALTHCHECK \
Expand Down
4 changes: 4 additions & 0 deletions roles/docker_service_deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ splunk_user: splunk
splunk_user_id: 8089
splunk_group: splunk
splunk_group_id: 8089

# https://docs.docker.com/reference/cli/docker/service/create/
# Note: Docker Swarm defaults to 10s
stop_grace_period: 10s
1 change: 1 addition & 0 deletions roles/docker_service_deploy/tasks/create_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
driver: "{{ log_driver | default(omit) }}"
options: "{{ log_driver_options | default(omit) }}"
env: "{{ env | default(omit) }}"
stop_grace_period: "{{ stop_grace_period | default(omit) }}"
become: "{{ docker_become_user is defined }}"
become_user: "{{ docker_become_user|default(omit) }}"
# tagged to allow skipping to allow only management of volumes
Expand Down