Refactor Docker setup for Laravel 5.0 compatibility and optimize deployment process
- Updated Dockerfile configurations for various environments (alpine, basic, cloudrun, minimal, simple, test) to ensure compatibility with Laravel 5.0 and PHP 5.6. - Added PHP compatibility documentation outlining mcrypt requirements and upgrade paths. - Created cloudbuild.yaml for Google Cloud Build integration to streamline deployment to Cloud Run. - Introduced docker-compose.local.yml for local development with MySQL and Redis services. - Enhanced rebuild.sh script for easier local development and migration handling. - Updated Laravel Blade views to correct asset paths. - Added start-local.sh script for quick local setup and service management.
This commit is contained in:
75
Dockerfile.simple
Normal file
75
Dockerfile.simple
Normal file
@@ -0,0 +1,75 @@
|
||||
# Ultra-minimal Dockerfile for Laravel 5.0 with PHP 5.6
|
||||
FROM php:5.6-apache
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Install packages one by one to identify issues
|
||||
RUN apt-get update
|
||||
|
||||
# Install core development tools first
|
||||
RUN apt-get install -y \
|
||||
curl \
|
||||
git \
|
||||
zip \
|
||||
unzip
|
||||
|
||||
# Install mcrypt (most important for Laravel 5.0)
|
||||
RUN apt-get install -y libmcrypt-dev \
|
||||
&& docker-php-ext-install mcrypt
|
||||
|
||||
# Install basic PHP extensions
|
||||
RUN docker-php-ext-install \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
mbstring
|
||||
|
||||
# Try to install GD dependencies
|
||||
RUN apt-get install -y \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-install gd
|
||||
|
||||
# Install zip extension
|
||||
RUN apt-get install -y zlib1g-dev \
|
||||
&& docker-php-ext-install zip
|
||||
|
||||
# Clean up
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Enable Apache rewrite module
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Configure Apache
|
||||
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
||||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
|
||||
|
||||
# Copy application files
|
||||
COPY . /var/www/html/
|
||||
|
||||
# Set basic permissions
|
||||
RUN chown -R www-data:www-data /var/www/html \
|
||||
&& chmod -R 755 /var/www/html
|
||||
|
||||
# Create .env file if needed
|
||||
RUN if [ ! -f /var/www/html/.env ]; then \
|
||||
cp /var/www/html/.env.example /var/www/html/.env; \
|
||||
fi
|
||||
|
||||
# Install dependencies without dev packages
|
||||
RUN composer install --no-dev --no-interaction || true
|
||||
|
||||
# Generate Laravel key
|
||||
RUN php artisan key:generate || true
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Start Apache
|
||||
CMD ["apache2-foreground"]
|
||||
Reference in New Issue
Block a user