Generate apply-ci docker image #1106
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: "Generate apply-ci docker image" | |
on: | |
schedule: | |
- cron: '30 5 * * *' | |
workflow_dispatch: | |
jobs: | |
build-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: | | |
docker build . --file ./docker/apply_ci.dockerfile --tag ministryofjustice/apply-ci:latest --tag ministryofjustice/apply-ci:latest-$(cat .ruby-version) | |
- name: Push the Docker image | |
run: | | |
docker push ministryofjustice/apply-ci:latest | |
docker push ministryofjustice/apply-ci:latest-$(cat .ruby-version) | |
- name: Slack Notification on failure | |
if: failure() | |
uses: slackapi/slack-github-action@v1.18.0 | |
with: | |
channel-id: 'apply-devtest' | |
payload: | | |
{ | |
"text": "GitHub apply-ci docker image Action build result: ${{ job.status }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "GitHub apply-ci docker Action build result: ${{ job.status }}\nAn error occurred while generating the apply-ci docker image" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |