Skip to content

Merge pull request #259 from roocs/ci-updates-docker #25

Merge pull request #259 from roocs/ci-updates-docker

Merge pull request #259 from roocs/ci-updates-docker #25

name: Docker-based Testing Suite
on:
push:
branches:
- master
pull_request:
concurrency:
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
jobs:
build:
name: Build and Test Docker image
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Build Docker image (no push)
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .
file: "Dockerfile"
tags: localrook:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
- name: Run Docker image
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 # v3
with:
image: localrook:latest
options: -p 5000:5000
run: |
rook start -d
sleep 2s
rook status
rook stop