Skip to content

Commit fdb5286

Browse files
authored
refactor: Huge refactoring of Dockerfiles (#64)
* refactor: clang-tools Dockerfiles * fix: update readme and fix snky * chore: remoev set -x * chore: Dockerfiles cleanup and updates * chore: update Dockerfile
1 parent 7711f8f commit fdb5286

26 files changed

+162
-602
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @shenxianpeng

.github/workflows/CI.yml

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ on:
44
push:
55
branches: [ master ]
66
paths:
7-
- '**Dockerfile'
7+
- 'Dockerfile*'
88
- 'docker-bake.hcl'
99
pull_request:
1010
branches: [ master ]
1111
paths:
12-
- '**Dockerfile'
12+
- 'Dockerfile*'
1313
- 'docker-bake.hcl'
1414
workflow_dispatch:
1515

@@ -25,53 +25,39 @@ jobs:
2525
- name: Check formatting
2626
run: make install-deps && make lint
2727

28-
- name: Get changed files
29-
id: changed-files
30-
uses: tj-actions/changed-files@v18.4
31-
3228
- name: Login container registries
3329
run: |
3430
echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin
3531
docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_PASSWORD }}'
3632
env:
3733
CR_PAT: ${{ secrets.CR_PAT }}
3834

39-
- name: Build & Test Images
40-
run: |
41-
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
42-
if [[ "$file" == *"Dockerfile" ]]; then
43-
set -e
44-
tag=`dirname $file`
45-
echo "start to build clang-tools:$tag"
46-
docker buildx bake --file docker-bake.hcl clang-tools-$tag
35+
- name: Check buildx bake
36+
run: docker buildx bake --file docker-bake.hcl --print
4737

48-
echo "start to test clang-tools:$tag"
49-
if [ $tag == "all" ]; then
50-
clang_versions="16 15 14 13 12 11 10 9 8"
51-
for clang_version in ${clang_versions}; do
52-
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
53-
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
54-
done
55-
elif [[ "$tag" == *"alpine"* ]]; then
56-
docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
57-
docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"
58-
else
59-
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
60-
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
61-
fi
62-
fi
63-
done
38+
- name: Build all images
39+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
40+
run: docker buildx bake --file docker-bake.hcl
6441

65-
- name: Publish Images
42+
- name: Test all images
6643
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
6744
run: |
68-
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
69-
if [[ "$file" == *"Dockerfile" ]]; then
70-
tag=`dirname $file`
71-
docker buildx bake --file docker-bake.hcl --push clang-tools-$tag
72-
fi
45+
echo "start to test clang-tools:all"
46+
clang_versions="17 16 15 14 13 12 11 10 9"
47+
for clang_version in ${clang_versions}; do
48+
docker run ghcr.io/cpp-linter/clang-tools:all clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
49+
docker run ghcr.io/cpp-linter/clang-tools:all clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
50+
done
51+
52+
all_tags="17 16 15 14 13 12 11 10 9 8 7"
53+
for tag in ${all_tags}; do
54+
echo "start to test clang-tools:tag"
55+
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
56+
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
7357
done
58+
# docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
59+
# docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"
7460
75-
- name: Publish All Images
61+
- name: Publish all images
7662
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
77-
run: docker buildx bake --file docker-bake.hcl --push clang-tools
63+
run: docker buildx bake --file docker-bake.hcl --push

.github/workflows/snyk-container.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ on:
1212
push:
1313
branches: [ master ]
1414
paths:
15-
- '**Dockerfile'
15+
- 'Dockerfile*'
1616
pull_request:
1717
branches: [ master ]
1818
paths:
19-
- '**Dockerfile'
19+
- 'Dockerfile*'
2020

2121
jobs:
2222
snyk:
@@ -33,7 +33,7 @@ jobs:
3333
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
3434
with:
3535
image: xianpengshen/clang-tools:all
36-
args: --severity-threshold=high --file=all/Dockerfile
36+
args: --severity-threshold=high --file=Dockerfile.all
3737

3838
- name: Upload result to GitHub Code Scanning
3939
uses: github/codeql-action/upload-sarif@v2

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ repos:
1313
- id: hadolint-docker
1414
args:
1515
[
16+
--ignore,DL3006,
1617
--ignore,DL3008,
1718
--ignore,DL3018,
1819
--ignore,SC2086,

10/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

11/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

12-alpine/Dockerfile

Lines changed: 0 additions & 23 deletions
This file was deleted.

12/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

13/Dockerfile

Lines changed: 0 additions & 31 deletions
This file was deleted.

13/sources.list.jammy

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)