Add Dockerfile for PHP 8.4-FPM environment setup
This commit is contained in:
parent
f5ca2c6bdd
commit
d6b5f0409c
|
|
@ -0,0 +1,68 @@
|
|||
# Use the official PHP 8.4 FPM image
|
||||
FROM php:8.4-fpm
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
libicu-dev \
|
||||
zip \
|
||||
unzip \
|
||||
nginx \
|
||||
supervisor \
|
||||
libmemcached-dev \
|
||||
zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip intl
|
||||
RUN pecl install memcached redis \
|
||||
&& docker-php-ext-enable memcached redis
|
||||
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Install Node.js and pnpm
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& npm install -g pnpm
|
||||
|
||||
# Install memcached and redis servers
|
||||
RUN apt-get update && apt-get install -y memcached redis-server && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy application files
|
||||
COPY . /app/.
|
||||
|
||||
# Create necessary directories
|
||||
RUN mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx
|
||||
|
||||
# Install PHP dependencies
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
|
||||
# Install Node.js dependencies and build assets
|
||||
RUN pnpm i --frozen-lockfile
|
||||
RUN pnpm run build || echo "Build step failed, continuing..."
|
||||
|
||||
# Copy supervisor configuration
|
||||
COPY docker/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Set permissions
|
||||
RUN chown -R www-data:www-data /app \
|
||||
&& chmod -R 755 /app/storage \
|
||||
&& chmod -R 755 /app/bootstrap/cache
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Start supervisor
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
Loading…
Reference in New Issue