Skip to content

Commit

Permalink
fix possibly problem with missing env causes by misuse runuser command
Browse files Browse the repository at this point in the history
  • Loading branch information
muhajirinlpu committed Dec 10, 2023
1 parent dc9a782 commit 9060ff0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion octane/20-extra.ini

This file was deleted.

11 changes: 4 additions & 7 deletions octane/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ RUN apt-get update \
php8.3-xml php8.3-zip php8.3-bcmath php8.3-soap \
php8.3-intl php8.3-readline \
php8.3-ldap php-pear \
&& pecl install igbinary redis \
&& rm -rf /tmp/pear \
&& pecl channel-update https://pecl.php.net/channel.xml \
&& pecl install igbinary redis swoole \
&& echo "extension=igbinary.so" > /etc/php/8.3/cli/conf.d/20-igbinary.ini \
&& echo "extension=redis.so" > /etc/php/8.3/cli/conf.d/20-redis.ini \
&& phpenmod igbinary redis \
&& echo "extension=swoole.so" > /etc/php/8.3/cli/conf.d/20-swoole.ini \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer global require --quiet --no-ansi laravel/envoy \
&& ln -s /root/.composer/vendor/laravel/envoy/bin/envoy /usr/bin/envoy \
Expand All @@ -42,8 +42,6 @@ RUN apt-get update \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt update && apt install nodejs -y \
&& npm install -g chokidar pnpm \
&& pecl channel-update https://pecl.php.net/channel.xml \
&& pecl install swoole \
# cleaning
&& composer clear-cache --quiet \
&& pecl clear-cache \
Expand All @@ -52,7 +50,6 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

COPY 20-extra.ini /etc/php/8.3/cli/conf.d/20-extra.ini
COPY runner.sh /runner.sh

# Add a non-root user to prevent files being created with root permissions on host machine.
Expand All @@ -73,4 +70,4 @@ WORKDIR /var/www
ARG DOCKER_ENV=production
ENV DOCKER_ENV ${DOCKER_ENV}

CMD "runuser" "-l" $USER_CONTAINER "-c" "/runner.sh $DOCKER_ENV"
CMD "runuser" "--preserve-environment" "-u" $USER_CONTAINER "/runner.sh" $DOCKER_ENV
2 changes: 1 addition & 1 deletion octane/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
if [ -d node_modules ]; then
echo "node_modules ok!"
else
npm install && npm install --dev chokidar
npm install
fi

echo "run on '$1' environment!"
Expand Down

0 comments on commit 9060ff0

Please sign in to comment.