diff --git a/build/Dockerfile b/build/Dockerfile index 514c905..2ba93a3 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -5,3 +5,6 @@ COPY watches.yaml ${HOME}/watches.yaml COPY ansible/zuul.yaml ${HOME}/zuul.yaml COPY ansible/group_vars/ ${HOME}/group_vars/ COPY ansible/roles/ ${HOME}/roles/ + +COPY build/uid_entrypoint.sh /uid_entrypoint +ENTRYPOINT [ "/uid_entrypoint" ] diff --git a/build/uid_entrypoint.sh b/build/uid_entrypoint.sh new file mode 100755 index 0000000..7efcf08 --- /dev/null +++ b/build/uid_entrypoint.sh @@ -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 "$@" diff --git a/deploy/operator.yaml b/deploy/operator.yaml index c720ea4..d94acdb 100644 --- a/deploy/operator.yaml +++ b/deploy/operator.yaml @@ -16,6 +16,7 @@ spec: containers: - name: ansible command: + - /uid_entrypoint - /usr/local/bin/ao-logs - /tmp/ansible-operator/runner - stdout