mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
* feat(ci): docker linting
adds hadolint to validate dockerfile best practices
configures project-specific rules in .hadolint.yaml
* fix(ci): enable hadolint console output
adds verbose and tty format to see linting results in CI logs
* test: trigger hadolint warning
remove --no-install-recommends to test CI output
* fix(ci): fail hadolint on warnings
stricter linting to catch all best practice violations
* fix: add --no-install-recommends to apt-get
reduces image size by avoiding unnecessary packages
* refactor: use WORKDIR instead of cd in dockerfile
replaces cd commands with WORKDIR for cleaner dockerfile
removes unnecessary hadolint ignore rules DL3003 and DL3009
* chore: simplify hadolint config
removes unnecessary override rules for cleaner config
(cherry picked from commit 82fef0c045)
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
# This workflow performs a quick Docker build check on PRs and pushes to master.
|
|
# It builds the Docker image and runs a basic smoke test to ensure the image works.
|
|
# This is a lightweight check - for full multi-platform builds and publishing, see docker-image.yml
|
|
name: Docker Check
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: hadolint/hadolint-action@v3.1.0
|
|
with:
|
|
dockerfile: Dockerfile
|
|
failure-threshold: warning
|
|
verbose: true
|
|
format: tty
|
|
|
|
build:
|
|
if: github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
env:
|
|
IMAGE_NAME: ipfs/kubo
|
|
WIP_IMAGE_TAG: wip
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image with BuildKit
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: ${{ env.IMAGE_NAME }}:${{ env.WIP_IMAGE_TAG }}
|
|
cache-from: |
|
|
type=gha
|
|
type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Test Docker image
|
|
run: docker run --rm $IMAGE_NAME:$WIP_IMAGE_TAG --version
|