add docker for local and production
This commit is contained in:
88
Dockerfile.dev
Normal file
88
Dockerfile.dev
Normal file
@@ -0,0 +1,88 @@
|
||||
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 \
|
||||
nodejs \
|
||||
npm \
|
||||
vim \
|
||||
nano \
|
||||
htop \
|
||||
&& 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 and Xdebug for development
|
||||
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 existing application directory permissions
|
||||
COPY --chown=www-data:www-data . /var/www/html
|
||||
|
||||
# Install PHP dependencies with dev packages
|
||||
RUN composer install --optimize-autoloader --no-interaction
|
||||
|
||||
# Install Node.js dependencies
|
||||
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 \
|
||||
&& 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 for development
|
||||
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 80 3000
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
Reference in New Issue
Block a user