incr/docker/dev/podman/Dockerfile

52 lines
1.3 KiB
Text
Raw Normal View History

2025-07-29 21:27:19 +02:00
FROM docker.io/library/php:8.2-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
nodejs \
npm \
default-mysql-client \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# 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 composer files and install PHP dependencies
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader --no-scripts
# Copy package.json and install Node dependencies
COPY package*.json ./
RUN npm ci
# Copy application code
COPY . .
# Set permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage \
&& chmod -R 755 /var/www/html/bootstrap/cache
# Create start script
RUN echo '#!/bin/bash\n\
php artisan serve --host=0.0.0.0 --port=8000 &\n\
npm run dev -- --host 0.0.0.0\n\
wait' > /usr/local/bin/start-dev.sh \
&& chmod +x /usr/local/bin/start-dev.sh
EXPOSE 8000 5173
CMD ["/usr/local/bin/start-dev.sh"]