Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Merge pull request #57 from GreenMeteor/dev #189

Merge pull request #57 from GreenMeteor/dev

Merge pull request #57 from GreenMeteor/dev #189

Workflow file for this run

name: Test Dockerfile
on:
push:
paths:
- 'src/Dockerfile'
- 'src/crontab'
pull_request:
paths:
- 'src/Dockerfile'
- 'src/crontab'
branches:
- main
jobs:
build:
name: Test on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Check Docker daemon
run: docker info || sudo service docker start
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU (Linux only)
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Validate Dockerfile
id: build
run: docker build -t humhub-test -f src/Dockerfile .
- name: Check Docker build status
run: docker inspect humhub-test
- name: Start container
id: start-container
run: docker run -d --name humhub-container humhub-test
- name: Wait for container to start
run: sleep 10 # Adjust sleep time as needed based on container startup time
- name: Verify Docker image and Check cron service status
run: |
docker run --rm humhub-test php -v || echo "::error::PHP verification failed"
docker run --rm humhub-test apache2 -v || echo "::error::Apache verification failed"
docker exec humhub-container service cron status || (docker logs humhub-container && echo "::error::Cron service verification failed")
- name: Copy crontab
run: docker cp src/crontab humhub-container:/etc/cron.d/humhub-cron
- name: Verify crontab
run: docker exec humhub-container bash -c 'chmod 0644 /etc/cron.d/humhub-cron && cat /etc/cron.d/humhub-cron' || echo "::error::Crontab verification failed"
- name: Run cron jobs
run: docker exec humhub-container cron -f &
- name: Cleanup
run: |
docker stop humhub-container || true
docker rm humhub-container || true