Search code examples
laravelgithub-actionslaravel-sail

GitHub Actions, Laravel 11 Sail problems


Trying to create GitHub Actions to deploy a Laravel 11 app running Laravel Sail. Almost all tasks run good, but at this point, an error occurs and I can't find the solution. Have created the docker image and pushed to DockerHub ok. The app runs goos at my local machine. Here is the YAML file at the .gitignore/workflows directory:

name: CI/CD Pipeline

on:
 push:
 branches:
  - main

jobs:
 build:
 runs-on: ubuntu-latest

steps:
  - name: Checkout code
    uses: actions/checkout@v3

  - name: Setup PHP
    uses: shivammathur/setup-php@v2
    with:
      php-version: '8.2'

  - name: Install Composer dependencies
    run: composer install --no-interaction --prefer-dist --optimize-autoloader

  - name: List files in runtimes directory
    run: ls -la ./vendor/laravel/sail/runtimes/8.3

  - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v2

  - name: Login to Docker Hub
    uses: docker/login-action@v2
    with:
      username: ${{ secrets.DOCKER_USERNAME }}
      password: ${{ secrets.DOCKER_PASSWORD }}

  - name: Build and push Docker image
    uses: docker/build-push-action@v3
    with:
      context: .
      file: ./vendor/laravel/sail/runtimes/8.3/Dockerfile
      push: true
      tags: marcellopato/webroker:latest
      build-args: |
        WWWGROUP=1000

deploy:
runs-on: ubuntu-latest
needs: build

steps:
  - name: Checkout code
    uses: actions/checkout@v3

  - name: Deploy to EC2
    uses: appleboy/[email protected]
    with:
      host: ${{ secrets.EC2_HOST }}
      username: ${{ secrets.EC2_USER }}
      key: ${{ secrets.EC2_KEY }}
      port: ${{ secrets.EC2_PORT }}
      script: |
        docker pull marcellopato/webroker:latest
        docker stop webroker || true
        docker rm webroker || true
        docker run -d --name webroker -p 80:8000 marcellopato/webroker:latest

And down here we can see the error while running tha Action:

  59 |     COPY start-container /usr/local/bin/start-container
  60 |     COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
  61 | >>> COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini
  62 |     RUN chmod +x /usr/local/bin/start-container
  63 |     
  --------------------
 ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of 
 ref v887cgr95ybaz3q64gl0c2lo9::vwav0i7uupd474mws0jlq4xv9: "/php.ini": not found
 Error: buildx failed with: ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref v887cgr95ybaz3q64gl0c2lo9::vwav0i7uupd474mws0jlq4xv9: "/php.ini": not found

The rest of the docker files are all from Laravel Sail and still originals. Anyone?


Solution

  • Are you using Sail in production?

    Sail is not for production use. Development only.

    If you don't know how to deploy Laravel to production, use Laravel Forge.