1

in local, i've set docker to mount the application path. from docker desktop, i set the File Sharing docker desktop > settings > resources > file sharing so docker can mount my apps. But i cannot find how to do it the same way with github action. So, i just pull my updated code to github below

web:
    container_name: oe-web
    build:
      context: ./
      dockerfile: Dockerfile
    depends_on:
     - db
    ports:
     - 8000:8000
    working_dir: /app
    volumes:
      - ./:/app

workflow

name: Docker Image CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Run docker-compose
      run: docker-compose up -d
    - name: Sleep for 20s
      uses: juliangruber/sleep-action@v1
      with:
        time: 10s
    - name: database migration with docker
      run: docker exec oe-web php artisan migrate
    - name: database seed with docker
      run: docker exec oe-web php artisan db:seed

and the github action return error when trying to build the docker

Run docker exec oe-web php artisan migrate
Error response from daemon: Container 27479cda84fb7f7c393bceeedbb2e2cf5ecd086917390728ac635748ac4411df is not running
Error: Process completed with exit code 1.

you can visit my pull request here: https://github.com/dhanyn10/open-ecommerce/pull/189

[UPDATED] error log

1s
Run chmod -R 777 ./
  chmod -R 777 ./
  docker-compose ps
  docker-compose logs
  shell: /usr/bin/bash -e {0}
   Name                 Command                State                      Ports                  
-------------------------------------------------------------------------------------------------
oe-adminer   entrypoint.sh php -S [::]: ...   Up         0.0.0.0:8080->8080/tcp,:::8080->8080/tcp
oe-db        docker-entrypoint.sh --def ...   Up         3306/tcp, 33060/tcp                     
oe-web       docker-php-entrypoint /bin ...   Exit 255       
dhanyn10
  • 704
  • 1
  • 9
  • 26
  • Please include your relevant workflow in your question. – Azeem Jan 28 '23 at 12:41
  • @Azeem updated, please help – dhanyn10 Jan 28 '23 at 16:01
  • Did you try to debug whether the container was actually up after that sleep? Maybe, it's not ready by the time the next step is executed and that's why you're getting that error. Also, you might need to verify it by running `docker-compose ps` after sleep. – Azeem Jan 28 '23 at 16:30
  • `docker-compose logs` may also be helpful for debugging. – Azeem Jan 28 '23 at 16:36
  • @Azeem updated, please help – dhanyn10 Jan 29 '23 at 14:04
  • In the output of `docker-compose ps`, the container `oe-web` exited with status code `255`. You need to debug it on your side by checking its startup logs, identify what's not working, and fix its startup sequence. – Azeem Jan 29 '23 at 15:19
  • @Azeem hi. im dont know how to check the startup logs inside github action. – dhanyn10 Feb 02 '23 at 10:48
  • See https://docs.docker.com/engine/reference/commandline/compose_logs/ and https://stackoverflow.com/questions/37195222/how-to-view-log-output-using-docker-compose-run. `docker-comopse logs oe-web` should work in your case. Simply, run `docker-compose up -d && sleep 20s && docker-compose ps && docker-compose logs oe-web`. – Azeem Feb 02 '23 at 12:59
  • I just looked at your last failed run and `oe-web` is failing with errors. See https://github.com/dhanyn10/open-ecommerce/actions/runs/4037113516/jobs/6940184095#step:5:62. – Azeem Feb 02 '23 at 13:01
  • Error: "**Fatal error: require(): Failed opening required '/app/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /app/artisan on line 18**". You need to fix this. – Azeem Feb 02 '23 at 13:02
  • Running `docker-compose logs` in your last commit did help. It printed logs for all the containers. See https://github.com/dhanyn10/open-ecommerce/actions/runs/4037113516/jobs/6940184095#step:5:13. – Azeem Feb 02 '23 at 13:04

0 Answers0