@@ -87654,83 +87654,6 @@ echo "Running migrations..."
8765487654php artisan migrate --force
8765587655``````
8765687656
87657- ## File: Dockerfile
87658- ``````dockerfile
87659- # Stage 1: Compile Frontend Assets
87660- FROM node:20-alpine AS node_builder
87661-
87662- WORKDIR /app/frontend
87663-
87664- # Copy package files and install dependencies
87665- COPY package.json package-lock.json* ./
87666- # Copy build configuration files
87667- COPY webpack.mix.js tailwind.config.js postcss.config.js* .babelrc* ./
87668- # Ensure postcss.config.js and .babelrc are optional by using *
87669-
87670- # Install dependencies for building assets
87671- # Using npm ci for cleaner installs if package-lock.json is present and up-to-date
87672- RUN npm ci --production
87673-
87674- # Copy frontend source code
87675- COPY resources/js ./resources/js
87676- COPY resources/css ./resources/css
87677- COPY resources/img ./resources/img
87678- # Add other resource directories if you have them (e.g., resources/fonts)
87679-
87680- # Compile assets
87681- RUN npm run production
87682-
87683- # Stage 2: Setup PHP Application Environment
87684- FROM ric_harvey/nginx-php-fpm:php82 AS app
87685-
87686- # Set working directory
87687- WORKDIR /var/www/html
87688-
87689- # Install system dependencies and PHP extensions
87690- # The ric_harvey/nginx-php-fpm image should have most common extensions.
87691- # We'll add pdo_mysql, gd, zip, bcmath, exif, opcache, intl if they are not present.
87692- # This often requires root access, then dropping back to www-data.
87693- # The exact commands depend on the base image's package manager (apk for Alpine).
87694- USER root
87695- RUN apk add --no-cache \
87696- libzip-dev \
87697- libpng-dev \
87698- libjpeg-turbo-dev \
87699- freetype-dev \
87700- && docker-php-ext-configure gd --with-freetype --with-jpeg \
87701- && docker-php-ext-install -j$(nproc) gd pdo_mysql zip bcmath exif opcache intl \
87702- && apk del libzip-dev libpng-dev libjpeg-turbo-dev freetype-dev \
87703- && rm -rf /var/cache/apk/*
87704-
87705- # Install Composer globally
87706- COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
87707-
87708- # Copy application files (respecting .dockerignore)
87709- COPY . .
87710-
87711- # Copy compiled assets from the node_builder stage
87712- COPY --chown=www-data:www-data --from=node_builder /app/frontend/public ./public
87713-
87714- # Set permissions for Laravel storage and bootstrap cache
87715- # Ensure these directories exist before chown/chmod if copying doesn't create them fully.
87716- RUN mkdir -p storage/framework/sessions storage/framework/cache/data storage/framework/views storage/logs \
87717- && chown -R www-data:www-data storage bootstrap/cache \
87718- && chmod -R 775 storage bootstrap/cache
87719-
87720- # Copy Nginx site configuration
87721- # The ric_harvey image might use /etc/nginx/conf.d/default.conf or similar.
87722- # We'll assume /etc/nginx/sites-available/default and ensure it's linked or directly used.
87723- COPY nginx-site.conf /etc/nginx/sites-available/default
87724- # If sites-enabled is used: RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
87725-
87726- # Copy and set permissions for the deploy script
87727- COPY deploy.sh /usr/local/bin/deploy.sh
87728- RUN chmod +x /usr/local/bin/deploy.sh
87729-
87730- # Expose port 80
87731- EXPOSE 80
87732- ``````
87733-
8773487657## File: nginx-site.conf
8773587658``````
8773687659server {
@@ -88682,6 +88605,83 @@ The project uses a modern stack (Laravel 10, Vue 3) and follows generally good p
8868288605- [ ] Clarify the meaning of "bot" in the initial project description. If there's specific automated functionality intended, it needs to be reviewed.
8868388606``````
8868488607
88608+ ## File: Dockerfile
88609+ ``````dockerfile
88610+ # Stage 1: Compile Frontend Assets
88611+ FROM node:20-alpine AS node_builder
88612+
88613+ WORKDIR /app/frontend
88614+
88615+ # Copy package files and install dependencies
88616+ COPY package.json package-lock.json* ./
88617+ # Copy build configuration files
88618+ COPY webpack.mix.js tailwind.config.js postcss.config.js* .babelrc* ./
88619+ # Ensure postcss.config.js and .babelrc are optional by using *
88620+
88621+ # Install dependencies for building assets
88622+ # Using npm ci for cleaner installs if package-lock.json is present and up-to-date
88623+ RUN npm ci --production
88624+
88625+ # Copy frontend source code
88626+ COPY resources/js ./resources/js
88627+ COPY resources/css ./resources/css
88628+ COPY resources/img ./resources/img
88629+ # Add other resource directories if you have them (e.g., resources/fonts)
88630+
88631+ # Compile assets
88632+ RUN npm run production
88633+
88634+ # Stage 2: Setup PHP Application Environment
88635+ FROM ric_harvey/nginx-php-fpm:3.1.6 AS app
88636+
88637+ # Set working directory
88638+ WORKDIR /var/www/html
88639+
88640+ # Install system dependencies and PHP extensions
88641+ # The ric_harvey/nginx-php-fpm image should have most common extensions.
88642+ # We'll add pdo_mysql, gd, zip, bcmath, exif, opcache, intl if they are not present.
88643+ # This often requires root access, then dropping back to www-data.
88644+ # The exact commands depend on the base image's package manager (apk for Alpine).
88645+ USER root
88646+ RUN apk add --no-cache \
88647+ libzip-dev \
88648+ libpng-dev \
88649+ libjpeg-turbo-dev \
88650+ freetype-dev \
88651+ && docker-php-ext-configure gd --with-freetype --with-jpeg \
88652+ && docker-php-ext-install -j$(nproc) gd pdo_mysql zip bcmath exif opcache intl \
88653+ && apk del libzip-dev libpng-dev libjpeg-turbo-dev freetype-dev \
88654+ && rm -rf /var/cache/apk/*
88655+
88656+ # Install Composer globally
88657+ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
88658+
88659+ # Copy application files (respecting .dockerignore)
88660+ COPY . .
88661+
88662+ # Copy compiled assets from the node_builder stage
88663+ COPY --chown=www-data:www-data --from=node_builder /app/frontend/public ./public
88664+
88665+ # Set permissions for Laravel storage and bootstrap cache
88666+ # Ensure these directories exist before chown/chmod if copying doesn't create them fully.
88667+ RUN mkdir -p storage/framework/sessions storage/framework/cache/data storage/framework/views storage/logs \
88668+ && chown -R www-data:www-data storage bootstrap/cache \
88669+ && chmod -R 775 storage bootstrap/cache
88670+
88671+ # Copy Nginx site configuration
88672+ # The ric_harvey image might use /etc/nginx/conf.d/default.conf or similar.
88673+ # We'll assume /etc/nginx/sites-available/default and ensure it's linked or directly used.
88674+ COPY nginx-site.conf /etc/nginx/sites-available/default
88675+ # If sites-enabled is used: RUN ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
88676+
88677+ # Copy and set permissions for the deploy script
88678+ COPY deploy.sh /usr/local/bin/deploy.sh
88679+ RUN chmod +x /usr/local/bin/deploy.sh
88680+
88681+ # Expose port 80
88682+ EXPOSE 80
88683+ ``````
88684+
8868588685## File: .circleci/config.yml
8868688686``````yaml
8868788687version: 2.1
0 commit comments