Build docker compose dev environment #1458
This file contains 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 characters
name: Build docker-compose dev environment | |
on: | |
schedule: | |
- cron: '6 6 * * *' | |
push: | |
pull_request: | |
jobs: | |
build-docker-compose: | |
name: "Build docker-compose-based development environment" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: docker-compose build | |
run: | | |
echo "UID=$(id -u)" >> .env | |
echo "GID=$(id -g)" >> .env | |
docker-compose build | |
- name: Verify containers stay running at least 1 minute | |
run: | | |
docker-compose up -d | |
sleep 60 | |
docker-compose ps | |
echo "Verifying service states" | |
docker-compose ps -q | xargs docker inspect -f '{{.State.Running}}' | grep -q false && exit 1 | |
echo "Looks ok" | |
- name: Print docker-compose logs | |
if: failure() | |
run: | | |
docker-compose logs | |
- name: Send GitHub Action trigger data to Slack workflow | |
id: slack | |
if: failure() | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
payload: | | |
{ | |
"title": "Building NAV's Docker Compose dev environment failed", | |
"github_ref_name": "${{ github.ref_name }}", | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |