1- FROM php:8.4 -fpm
1+ FROM php:8.2 -fpm
22LABEL org.opencontainers.image.authors="stephen@stephenneal.net"
33
44# Update OS && install utilities
@@ -37,4 +37,40 @@ RUN docker-php-ext-configure intl \
3737
3838# Copy PHP configuration files
3939COPY local.ini /usr/local/etc/php/conf.d/local.ini
40- COPY www.conf /usr/local/etc/php-fpm.d/www.conf
40+ COPY www.conf /usr/local/etc/php-fpm.d/www.conf
41+
42+ # Set working directory
43+ WORKDIR /var/www/html
44+
45+ # Install Nginx
46+ RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
47+
48+ # Install Composer
49+ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
50+
51+ # Copy application skeleton (respects .dockerignore)
52+ # Ensure .dockerignore is set up to exclude vendor, node_modules, .env etc.
53+ COPY . .
54+
55+ # Install PHP dependencies
56+ RUN composer install --optimize-autoloader --no-dev --no-interaction --no-progress
57+
58+ # Set permissions for Laravel
59+ RUN chown -R www-data:www-data storage bootstrap/cache \
60+ && chmod -R 775 storage bootstrap/cache
61+
62+ # Copy Nginx site configuration
63+ # This assumes nginx-site.conf is for Nginx and configured for Laravel
64+ COPY nginx-site.conf /etc/nginx/sites-available/default
65+ RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default || true \
66+ && rm /etc/nginx/sites-enabled/default.conf || true # Remove default Nginx config if it exists with this name
67+
68+ # Copy deploy script (which handles migrations, caching)
69+ COPY deploy.sh /usr/local/bin/deploy.sh
70+ RUN chmod +x /usr/local/bin/deploy.sh
71+
72+ # Expose port 80 for Nginx
73+ EXPOSE 80
74+
75+ # CMD / ENTRYPOINT to start supervisor (which then starts nginx and php-fpm) will be added later.
76+ # Frontend asset compilation (Node.js multi-stage build) will also be added later.
0 commit comments