Skip to content

Dockerfile Check

Dockerfile Check #24

Workflow file for this run

name: Dockerfile Check
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight
jobs:
check_dockerfile:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build -t my-docker-image .
- name: Test Docker Run
run: |
docker run --rm my-docker-image /bin/bash -c "echo 'Docker passed'"
- name: Set Badge Status
id: set-badge
run: |
status="Docker build passed"
if [ $? -ne 0 ]; then
status="Docker build failed"
fi
echo "Status=$status" >> $GITHUB_ENV
echo "Color=$([[ $status == 'Docker build passed' ]] && echo '00FF00' || echo 'FF0000')" >> $GITHUB_ENV
- name: Docker Badge
uses: RubbaBoy/[email protected]
with:
NAME: docker-badge
LABEL: 'Docker Status'
ICON: 'docker'
STATUS: ${{ env.Status }}
COLOR: ${{ env.Color }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}