Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dockerfile #665

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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