Skip to content

Commit

Permalink
chore: npm build in dockerfile (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadrubo authored Jul 18, 2023
1 parent 2403bcc commit 9bee56e
Show file tree
Hide file tree
Showing 11 changed files with 383 additions and 648 deletions.
12 changes: 0 additions & 12 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ RUN composer install --no-interaction --prefer-dist --optimize-autoloader --no-d
&& chown -R webuser:webgroup /var/www/html

# Install npm dependencies
RUN npm ci
RUN npm pkg delete scripts.prepare
RUN npm ci \
&& npm run build \
&& npm cache clean --force

VOLUME /config
21 changes: 0 additions & 21 deletions docker/deploy/etc/s6-overlay/scripts/laravel-automations
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,6 @@ s6-setuidgid webuser php $WEBUSER_HOME/artisan storage:link --no-ansi -q
echo "✅ Storage linked."
echo ""

# Build the npm dependencies
# npm dependencies are built in here instead of the Dockerfile to allow for changing
# the credentials for laravel echo to something secure.
# Vite needs to run it's build script in order for these credentials to apply.
if [ ! -d "$WEBUSER_HOME/public/build" ]; then
echo "Building Vite for the first time..."
npm run --prefix $WEBUSER_HOME build &> '/dev/null'
echo "Vite built."
echo ""
fi

# if [ -n "$(diff -q $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old)" ]; then
if [ -f "$WEBUSER_HOME/.env.old" ] && [ -n "$(diff -q $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old)" ]; then
echo "Building Vite because your .env file has changed..."
npm run --prefix $WEBUSER_HOME build &> '/dev/null'
echo "Vite built."
echo ""
fi

cp $WEBUSER_HOME/.env $WEBUSER_HOME/.env.old

# Build cache
echo "💰 Building the cache..."
s6-setuidgid webuser php $WEBUSER_HOME/artisan config:cache --no-ansi -q
Expand Down
Loading

0 comments on commit 9bee56e

Please sign in to comment.