Skip to content

Commit

Permalink
Merge pull request #665 from turbo124/debian
Browse files Browse the repository at this point in the history
Update dockerfile
  • Loading branch information
turbo124 authored Dec 3, 2024
2 parents 113c700 + f281b33 commit 84dcb8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ RUN mkdir -p \

RUN cp /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html

# copy the public/ directory into a separate folder so that we can overwrite the volume later via the entrypoint
RUN mkdir -p /image-original/public && cp -r /var/www/html/public /image-original/public

# Set permissions
RUN chown -R www-data:www-data \
/var/www/html/storage \
Expand Down
17 changes: 17 additions & 0 deletions debian/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ chmod -R 775 \

chown -R www-data:www-data /var/www/html/storage

# Ensure symlink for storage/app/public
if [ ! -L /var/www/html/public/storage ]; then
echo "Creating symlink for storage/app/public..."
ln -sfn /var/www/html/storage/app/public /var/www/html/public/storage
fi

# Clean the existing public/ directory but exclude .js and .css files
if [ -d /var/www/html/public ]; then
echo "Cleaning up stale files in public/ directory, retaining .js and .css files..."
find /var/www/html/public -type f ! -name '*.js' ! -name '*.css' -exec rm -f {} \;
fi

# Copy the public/ directory from the image to the mounted volume
echo "Copying public/ directory from image to volume..."
cp -r /image-original/public/* /var/www/html/public/


# Clear and cache config in production
if [ "$APP_ENV" = "production" ]; then
gosu www-data php artisan config:cache
Expand Down

0 comments on commit 84dcb8c

Please sign in to comment.