Skip to content

Docker Hub

Docker Hub #3

Workflow file for this run

name: Docker Hub
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run string replace
uses: frabert/replace-string-action@v2
id: format-tag
with:
pattern: "hipcheck-v"
string: "${{ github.event.release.tag_name || github.event.inputs.version }}"
replace-with: ""
flags: "g"
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout the Hipcheck Repository
uses: actions/checkout@v4
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: Containerfile
push: true
platforms: "linux/amd64,linux/arm64"
tags: mitre/hipcheck:latest,mitre/hipcheck:${{ steps.format-tag.outputs.replaced }}
- name: Verify Dockerhub Description Size
id: verify_dockerhub_readme_size
run: |
FILE_PATH="./dist/dockerhub/README.md"
MAX_SIZE=25000
if [ ! -f "$FILE_PATH" ]; then
echo "File does not exist: $FILE_PATH"
exit 1
fi
FILE_SIZE=$(wc -c < $FILE_PATH)
if [ $FILE_SIZE -ge $MAX_SIZE ]; then
echo "File is too large: $FILE_SIZE bytes (MAX allowed is $MAX_SIZE)"
exit 1
fi
echo "File is small enough to push: $FILE_SIZE (MAX allowed is $MAX_SIZE)"
- name: Update Dockerhub description
if: success()
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
readme-filepath: ./dist/dockerhub/README.md