add build and storage link

This commit is contained in:
2025-09-19 21:59:22 +07:00
parent 9f500a5da2
commit c01d95a61b

View File

@@ -21,6 +21,8 @@ RUN apt-get update && apt-get install -y \
libvpx-dev \ libvpx-dev \
supervisor \ supervisor \
nginx \ nginx \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install PHP extensions # Install PHP extensions
@@ -44,14 +46,21 @@ RUN pecl install redis \
# Install Composer # Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy only composer files first for caching # Copy only composer and package files first for caching
COPY composer.json composer.lock ./ COPY composer.json composer.lock package.json package-lock.json ./
# Install PHP dependencies (cached if lock file unchanged)
RUN composer install --optimize-autoloader --no-dev --no-interaction
# Install Node dependencies (cached if lock file unchanged)
RUN npm ci --only=production
# Now copy the full Laravel application code # Now copy the full Laravel application code
COPY . . COPY . .
# Install PHP dependencies (cached if lock file unchanged) # Build assets and create storage link
RUN composer install --optimize-autoloader --no-dev --no-interaction RUN npm run production && \
php artisan storage:link
# Set proper permissions (for production only do this once) # Set proper permissions (for production only do this once)
RUN mkdir -p storage/logs \ RUN mkdir -p storage/logs \