add docker for local and production

This commit is contained in:
2025-06-10 22:29:30 +07:00
parent 84fb7ffb52
commit f92655e3e2
1449 changed files with 3115 additions and 0 deletions

77
Dockerfile Normal file
View File

@@ -0,0 +1,77 @@
FROM php:8.1-fpm
# Set working directory
WORKDIR /var/www/html
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libcurl4-openssl-dev \
pkg-config \
libpng-dev \
libonig-dev \
libxml2-dev \
libzip-dev \
zip \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libxpm-dev \
libvpx-dev \
supervisor \
nginx \
&& rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-xpm \
&& docker-php-ext-install -j$(nproc) \
curl \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
zip \
dom \
xml
# Install Redis extension
RUN pecl install redis \
&& docker-php-ext-enable redis
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy existing application directory contents
COPY . /var/www/html
# Copy existing application directory permissions
COPY --chown=www-data:www-data . /var/www/html
# Install PHP dependencies
RUN composer install --optimize-autoloader --no-dev --no-interaction
# 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 \
&& 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 nginx config
COPY ./docker/nginx.conf /etc/nginx/sites-available/default
# Create supervisor config
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Expose port 9000 and start php-fpm server
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]