# Frontend Image FROM node:20 as frontend RUN mkdir -p /app/public COPY package.json package-lock.json vite.config.js /app/ # Copy your JavaScript source files COPY resources/ /app/resources/ WORKDIR /app # Install dependencies RUN npm ci # Run build RUN npm build # Base Image FROM serversideup/php:8.3-cli AS base # Switch to root so we can do root things USER root # Do root things # Install the intl extension with root permissions RUN install-php-extensions intl imagick bcmath gd json openswoole # Drop back to our unprivileged user USER www-data # Development Image FROM base AS development # Install the xdebug extension with root permissions # Switch to root so we can do it USER root RUN install-php-extensions xdebug # Drop back to our unprivileged user USER www-data # Production Image FROM base AS production COPY --chown=www-data:www-data . /var/www/html # Copy code JS/CSS build from frontend COPY --from=frontend /app/public/build/ /var/www/html/public/build CMD ["php", "artisan", "octane:start", "--server=swoole", "--host=0.0.0.0"] HEALTHCHECK --interval=10m --timeout=5s \ CMD curl -f http://127.0.0.1:8000/up || exit 1