55 lines
No EOL
1.4 KiB
Docker
55 lines
No EOL
1.4 KiB
Docker
FROM docker.io/library/php:8.4-fpm
|
|
|
|
# Install system dependencies including nginx
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
libpng-dev \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
zip \
|
|
unzip \
|
|
nodejs \
|
|
npm \
|
|
nginx \
|
|
default-mysql-client \
|
|
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd \
|
|
&& pecl install redis xdebug \
|
|
&& docker-php-ext-enable redis xdebug
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Install Node.js 20.x (for better compatibility)
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Install PHP dependencies in backend
|
|
WORKDIR /var/www/html/backend
|
|
RUN composer install --optimize-autoloader --no-scripts
|
|
|
|
# Build React frontend
|
|
WORKDIR /var/www/html/frontend
|
|
RUN npm install && npm run build
|
|
|
|
# Back to main directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 755 /var/www/html/backend/storage \
|
|
&& chmod -R 755 /var/www/html/backend/bootstrap/cache
|
|
|
|
# Copy and set up container start script
|
|
COPY docker/dev/podman/container-start.sh /usr/local/bin/container-start.sh
|
|
RUN chmod +x /usr/local/bin/container-start.sh
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["/usr/local/bin/container-start.sh"] |