dev (#1)
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s

Co-authored-by: Frank John Begornia <frank.begornia@yahoo.com>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2025-12-22 15:28:42 +00:00
parent 70496dc874
commit b47e4e8d3c
59 changed files with 2230 additions and 432 deletions

104
Dockerfile Normal file → Executable file
View File

@@ -1,46 +1,86 @@
# Use the official PHP image based on Alpine Linux
FROM php:5.6-fpm-alpine
# Use PHP 7.0 with Apache (has native mcrypt support for Laravel 5.0)
FROM php:7.0-apache
# Install system dependencies and PHP extensions
RUN apk --update --no-cache add \
nginx \
# Update to use archived Debian repositories
RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list \
&& sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list \
&& sed -i '/stretch-updates/d' /etc/apt/sources.list
# Install system dependencies
RUN apt-get update && apt-get install -y --allow-unauthenticated \
git \
curl \
libpng-dev \
libjpeg-turbo-dev \
freetype-dev \
libzip-dev \
libxml2-dev \
libmcrypt-dev \
zip \
unzip \
libmcrypt-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql zip mcrypt
libfreetype6-dev \
libjpeg62-turbo-dev \
openssh-client \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
# Set the working directory in the container
WORKDIR /var/www
# Install PHP extensions (mcrypt is built-in for PHP 7.0)
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath mcrypt tokenizer zip
# Clear cache
# RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Copy the Laravel application files to the container
COPY . .
# Install Composer (version 1.x for better compatibility with Laravel 5.0)
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
# Set appropriate permissions for Laravel storage and bootstrap cache
RUN chown -R www-data:www-data storage bootstrap
# Set working directory
WORKDIR /var/www/html
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy existing application directory contents
COPY . /var/www/html
# Install Laravel dependencies
RUN composer install --no-plugins --no-scripts
# Create storage directories and set permissions
RUN mkdir -p storage/framework/views \
storage/framework/cache \
storage/framework/sessions \
storage/logs \
bootstrap/cache
# Generate Laravel application key
RUN php artisan key:generate
# Set proper ownership and permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 775 /var/www/html/storage \
&& chmod -R 775 /var/www/html/bootstrap/cache
# Create directory for the socket and set permissions
RUN mkdir -p /run/php && chown www-data:www-data /run/php
# Create .env file if it doesn't exist
RUN if [ ! -f .env ]; then cp .env.example .env; fi
# Copy the www.conf file to PHP-FPM pool.d directory
# COPY www.conf /usr/local/etc/php-fpm.d/www.conf
# Install PHP dependencies (Laravel 5.0 compatible)
RUN composer install --no-dev --no-interaction --prefer-dist
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
# Generate application key
RUN php artisan key:generate || true
# Run Laravel 5.0 optimization
RUN php artisan clear-compiled && php artisan optimize
# Note: yakpro-po obfuscation requires PHP 7.1+, incompatible with PHP 7.0
# For code protection with PHP 7.0, consider:
# 1. ionCube Encoder (commercial, most secure)
# 2. Keeping source code private and using proper access controls
# 3. Using --optimize flag in composer (already done above)
# Configure Apache DocumentRoot to point to Laravel's public directory
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
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
# Suppress Apache ServerName warning
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port 80
EXPOSE 80
# Use entrypoint to set up permissions before starting Apache
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]