Add uid entrypoint

This commit is contained in:
Tristan Cacqueray 2019-04-05 09:07:42 +00:00
parent 493adbe7cc
commit 31a7934291
3 changed files with 12 additions and 0 deletions

View File

@ -5,3 +5,6 @@ COPY watches.yaml ${HOME}/watches.yaml
COPY ansible/zuul.yaml ${HOME}/zuul.yaml COPY ansible/zuul.yaml ${HOME}/zuul.yaml
COPY ansible/group_vars/ ${HOME}/group_vars/ COPY ansible/group_vars/ ${HOME}/group_vars/
COPY ansible/roles/ ${HOME}/roles/ COPY ansible/roles/ ${HOME}/roles/
COPY build/uid_entrypoint.sh /uid_entrypoint
ENTRYPOINT [ "/uid_entrypoint" ]

8
build/uid_entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if ! whoami &> /dev/null; then
if [ -w /etc/passwd ]; then
echo "${USER_NAME:-default}:x:$(id -u):0:${USER_NAME:-default} user:${HOME}:/sbin/nologin" >> /etc/passwd
fi
fi
exec "$@"

View File

@ -16,6 +16,7 @@ spec:
containers: containers:
- name: ansible - name: ansible
command: command:
- /uid_entrypoint
- /usr/local/bin/ao-logs - /usr/local/bin/ao-logs
- /tmp/ansible-operator/runner - /tmp/ansible-operator/runner
- stdout - stdout