Files
merchbay/Dockerfile.alpine
Frank John Begornia 02c7f4e2aa 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.
2025-08-11 23:14:31 +08:00

72 lines
1.8 KiB
Docker

# Debug Dockerfile - Let's try the original approach that was working
FROM php:5.6-fpm-alpine
# Set working directory
WORKDIR /var/www
# Install system dependencies and PHP extensions
RUN apk --update --no-cache add \
nginx \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
zip \
unzip \
libmcrypt-dev \
curl \
git \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd pdo pdo_mysql zip mcrypt mbstring
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy the Laravel application files to the container
COPY . .
# Set appropriate permissions for Laravel storage and bootstrap cache
RUN chown -R www-data:www-data storage bootstrap/cache
# Install Laravel dependencies
RUN composer install --no-interaction --no-plugins --no-scripts --no-dev
# Create .env file
RUN if [ ! -f .env ]; then cp .env.example .env; fi
# Generate application key
RUN php artisan key:generate || true
# Create directory for the socket and set permissions
RUN mkdir -p /run/php && chown www-data:www-data /run/php
# Configure nginx for Laravel
RUN echo 'server {
listen 80;
server_name localhost;
root /var/www/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}' > /etc/nginx/conf.d/default.conf
# Create startup script
RUN echo '#!/bin/sh
php-fpm -D
nginx -g "daemon off;"' > /start.sh && chmod +x /start.sh
# Expose port 80
EXPOSE 80
# Start both PHP-FPM and Nginx
CMD ["/start.sh"]