Last active
          May 17, 2024 21:35 
        
      - 
      
- 
        Save AlexR1712/41fe68b1b9a645c74954e1a391b9607d to your computer and use it in GitHub Desktop. 
Revisions
- 
        AlexR1712 revised this gist May 17, 2024 . No changes.There are no files selected for viewing
- 
        AlexR1712 revised this gist May 17, 2024 . No changes.There are no files selected for viewing
- 
        AlexR1712 created this gist May 17, 2024 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ # 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 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,87 @@ version: "3" services: php: restart: unless-stopped build: context: . target: development dockerfile: Dockerfile command: ["php", "artisan", "octane:start", "--server=swoole", "--host=0.0.0.0"] ports: - "8000:8000" depends_on: - mysql environment: - PHP_OPCACHE_ENABLE=1 - AUTORUN_ENABLED=false - SSL_MODE=mixed - DB_HOST=mysql - DB_PORT=3306 - DB_DATABASE=homestead - DB_USERNAME=homestead - DB_PASSWORD=secret - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_PASSWORD=password volumes: - .:/var/www/html env_file: - .env mysql: hostname: mysql restart: unless-stopped image: mysql:8.0.37-bookworm ports: - "3306:3306" environment: MYSQL_DATABASE: 'homestead' MYSQL_USER: 'homestead' MYSQL_PASSWORD: 'secret' MYSQL_ROOT_PASSWORD: 'secret' volumes: - database:/var/lib/mysql node: image: node:20 volumes: - .:/var/www/html working_dir: /var/www/html vite: image: node:20 volumes: - .:/var/www/html working_dir: /var/www/html command: ["npm", "run", "dev"] ports: - "5173:5173" ## Container for test using image for Production prod: restart: unless-stopped build: context: . target: production dockerfile: Dockerfile ports: - "8001:8000" depends_on: - mysql environment: - PHP_OPCACHE_ENABLE=1 - AUTORUN_ENABLED=false - SSL_MODE=mixed - DB_HOST=mysql - DB_PORT=3306 - DB_DATABASE=homestead - DB_USERNAME=homestead - DB_PASSWORD=secret - REDIS_HOST=redis - REDIS_PORT=6379 - REDIS_PASSWORD=password env_file: - .env volumes: database: