fix application build without composer auth

This commit is contained in:
Ronald A. Richardson
2023-08-10 15:38:45 +08:00
parent fca83a25e5
commit f956f853e1

View File

@@ -59,8 +59,12 @@ RUN chmod -R 755 ./storage
# Load the secret into the auth.json file if exists, and install dependencies
COPY composer-auth.jso[n] /root/.composer/auth.json
RUN --mount=type=secret,id=composer_auth,target=/root/.composer/auth.json \
cp /root/.composer/auth.json /var/www/.composer/auth.json 2>/dev/null && \
chown www-data:www-data /var/www/.composer/auth.json && \
if [ -f "/root/.composer/auth.json" ]; then \
mkdir -p /var/www/.composer/ && \
cp /root/.composer/auth.json /var/www/.composer/auth.json && \
chown www-data:www-data /var/www/.composer/auth.json && \
su www-data -s /bin/sh -c "composer install && composer dumpautoload"; \
fi; \
su www-data -s /bin/sh -c "composer install && composer dumpautoload"
# Continue