Skip to content

Commit

Permalink
[BUGFIX] Docker twaks as-sudo do not preserve the Docker image ENV
Browse files Browse the repository at this point in the history
This change makes it possible to re-use the default ENV variables in scripts within
`/docker-entrypoint-initdb.d-as-sudo/` folder.

Ports: TYPO3-Solr#4310
  • Loading branch information
dkd-kaehm committed Jan 30, 2025
1 parent 6ac30c1 commit 6c2258d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Docker/SolrServer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN rm -fR /opt/solr/server/solr/* \
&& groupmod --non-unique --gid "${SOLR_UNIX_GID}" solr \
&& chown -R solr:solr /var/solr /opt/solr \
&& apt update && apt upgrade -y && apt install sudo -y \
&& echo "solr ALL=NOPASSWD: /docker-entrypoint-initdb.d-as-sudo/*" > /etc/sudoers.d/solr
&& echo "solr ALL=NOPASSWD:SETENV: /docker-entrypoint-initdb.d-as-sudo/*" > /etc/sudoers.d/solr

COPY Docker/SolrServer/docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d
COPY Docker/SolrServer/docker-entrypoint-initdb.d-as-sudo/ /docker-entrypoint-initdb.d-as-sudo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
# execute files in /docker-entrypoint-initdb.d/as-sudo/*.sh before starting solr
while read -r f; do
case "$f" in
*.sh) echo "$0: running 'sudo $f'"; sudo "$f" ;;
*.sh) echo "$0: running 'sudo $f'"; sudo --preserve-env "$f" ;;
*) echo "$0: ignoring $f" ;;
esac
echo
Expand Down

0 comments on commit 6c2258d

Please sign in to comment.