fix styling and try optimize dockerfile
This commit is contained in:
@@ -17,7 +17,6 @@ RUN apt-get update && apt-get install -y \
|
||||
unzip \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libpng-dev \
|
||||
libxpm-dev \
|
||||
libvpx-dev \
|
||||
supervisor \
|
||||
@@ -43,47 +42,41 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-xpm \
|
||||
dom \
|
||||
xml
|
||||
|
||||
# Install Redis and Xdebug for development
|
||||
# Install Redis and Xdebug
|
||||
RUN pecl install redis xdebug \
|
||||
&& docker-php-ext-enable redis xdebug
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Copy existing application directory contents
|
||||
COPY . /var/www/html
|
||||
# Copy dependency files first for better caching
|
||||
COPY composer.json composer.lock ./
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Copy existing application directory permissions
|
||||
COPY --chown=www-data:www-data . /var/www/html
|
||||
# Now copy the entire application code (after npm/composer install)
|
||||
COPY . .
|
||||
|
||||
# Install PHP dependencies with dev packages
|
||||
RUN composer install --optimize-autoloader --no-interaction
|
||||
# Install PHP dependencies (with dev)
|
||||
RUN composer install --no-interaction
|
||||
|
||||
# Install Node.js dependencies
|
||||
# Install Node dependencies (cached if package-lock.json not changed)
|
||||
RUN npm install
|
||||
|
||||
# Create necessary directories and set permissions
|
||||
RUN mkdir -p /var/www/html/storage/logs \
|
||||
&& mkdir -p /var/www/html/storage/framework/cache \
|
||||
&& mkdir -p /var/www/html/storage/framework/sessions \
|
||||
&& mkdir -p /var/www/html/storage/framework/views \
|
||||
&& mkdir -p /var/www/html/storage/app \
|
||||
&& mkdir -p /var/www/html/bootstrap/cache \
|
||||
# Set ownership and permissions
|
||||
RUN mkdir -p storage/logs \
|
||||
&& mkdir -p storage/framework/{cache,sessions,views} \
|
||||
&& mkdir -p storage/app \
|
||||
&& mkdir -p bootstrap/cache \
|
||||
&& chown -R www-data:www-data /var/www/html \
|
||||
&& chmod -R 775 /var/www/html/storage \
|
||||
&& chmod -R 775 /var/www/html/bootstrap/cache \
|
||||
&& chmod -R 755 /var/www/html/public
|
||||
&& chmod -R 775 storage bootstrap/cache \
|
||||
&& chmod -R 755 public
|
||||
|
||||
# Create nginx config for development
|
||||
# Copy configs
|
||||
COPY ./docker/nginx.dev.conf /etc/nginx/sites-available/default
|
||||
|
||||
# Create supervisor config for development
|
||||
COPY ./docker/supervisord.dev.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Create Xdebug config
|
||||
COPY ./docker/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
|
||||
|
||||
# Expose ports
|
||||
# Expose web port + possible Webpack/Vite
|
||||
EXPOSE 80 3000
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
|
||||
Reference in New Issue
Block a user