Skip to content

Commit 283dd02

Browse files
committed
fix: composer prevents plugin execution as root
Within the context of Docker image builds this should be safe, but not relying on the bamarni-bin[1] package would be better. [1] Package that is used for the installation of the packages and their associated binaries (vendor/bin/*) within separate global directories, in order to avoid conflicting version requirements.
1 parent 754d9a0 commit 283dd02

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Dockerfile.php7-review

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ RUN mkdir -p /opt
55

66
WORKDIR /opt/
77

8+
# Do not run Composer as root/super user! See https://getcomposer.org/root for details
9+
# Aborting as no plugin should be loaded if running as super user is not explicitly allowed
10+
ENV COMPOSER_ALLOW_SUPERUSER=1
11+
812
# install php-tools
913
RUN git clone https://github.com/linkorb/php-tools.git
1014
RUN cd php-tools && COMPOSER_MEMORY_LIMIT=-1 /usr/bin/composer install

Dockerfile.php8-review

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ RUN mkdir -p /opt
55

66
WORKDIR /opt/
77

8+
# Do not run Composer as root/super user! See https://getcomposer.org/root for details
9+
# Aborting as no plugin should be loaded if running as super user is not explicitly allowed
10+
ENV COMPOSER_ALLOW_SUPERUSER=1
11+
812
# install php-tools
913
RUN git clone https://github.com/linkorb/php-tools.git
1014
RUN cd php-tools && COMPOSER_MEMORY_LIMIT=-1 /usr/bin/composer install

0 commit comments

Comments
 (0)