Merge pull request #665 from turbo124/debian

Update dockerfile
This commit is contained in:
David Bomba
2024-12-03 12:40:39 +11:00
committed by GitHub
2 changed files with 20 additions and 0 deletions

3
debian/Dockerfile vendored
View File

@@ -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 \

View File

@@ -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