From 845ca5c6b3997f554b8ae1626a02f9d3618ea6f0 Mon Sep 17 00:00:00 2001 From: Joao Patricio Date: Wed, 29 Mar 2023 16:39:08 +0100 Subject: [PATCH] Prepare GH Action and Pest --- .github/workflows/docker-image.yml | 27 +++++++++---------- docker-compose.yaml | 43 +++++++++++++++--------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 77a715a14..c42a18f2c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -13,17 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: | - docker run --rm -u "$(id -u):$(id -g)" \ - -v "$(pwd):/app" \ - -w /app composer:2 \ - composer install --ignore-platform-reqs - TAG=$(date +%s) ./vendor/bin/sail build - TAG=$(date +%s) ./vendor/bin/sail up -d - sleep 1 - ./vendor/bin/sail ps - # Now to create .env - # Await database is created - # pest + - uses: actions/checkout@v3 + - name: Build the Docker image + run: | + cp .env.example .env + docker run --rm -u "$(id -u):$(id -g)" \ + -v "$(pwd):/app" \ + -w /app composer:2 \ + composer install --ignore-platform-reqs + ./vendor/bin/sail build + ./vendor/bin/sail up -d + ./vendor/bin/sail artisan key:generate + ./vendor/bin/sail artisan migrate:fresh --seed + ./vendor/bin/pest diff --git a/docker-compose.yaml b/docker-compose.yaml index 2b1379e2d..1e8869356 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,16 @@ version: '3.8' + +x-testing-host: &testing-host-base + image: coolify-testing-host + build: + dockerfile: Dockerfile + context: ./docker/testing-host + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf + networks: + - coolify + services: php: image: "coolify:${TAG:-4}" @@ -19,6 +31,9 @@ services: - .:/var/www/html networks: - coolify + depends_on: + postgres: + condition: service_healthy postgres: image: postgres:15-alpine ports: @@ -36,34 +51,18 @@ services: test: [ "CMD-SHELL", - "pg_isready -U $$DB_USERNAME", + "pg_isready -U coolify", "-d", - "db_prod" + "coolify" ] - retries: 3 - timeout: 5s + retries: 5 + timeout: 10s testing-host: + <<: *testing-host-base container_name: coolify-testing-host - image: coolify-testing-host - build: - dockerfile: Dockerfile - context: ./docker/testing-host - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf - networks: - - coolify testing-host2: + <<: *testing-host-base container_name: coolify-testing-host-2 - image: coolify-testing-host - build: - dockerfile: Dockerfile - context: ./docker/testing-host - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf - networks: - - coolify volumes: db-coolify: