SHA256
first commit
This commit is contained in:
commit
ee71d38ace
11 files changed
+663
No files matched your search
@@ -0,0 +1,66 @@
|
||||
name: Dynamic Build and Deploy Hardened Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 0 * * 5'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Prepare Git for SHA256 Repo
|
||||
run: git config --global init.defaultObjectFormat sha256
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to DHI Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: dhi.io
|
||||
username: ${{ secrets.DHI_USERNAME }}
|
||||
password: ${{ secrets.DHI_PASSWORD }}
|
||||
|
||||
- name: Log in to Private Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.chillcog.com
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Detect and Build Images
|
||||
run: |
|
||||
FILES_TO_BUILD=""
|
||||
|
||||
if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "Scheduled or manual run triggered. Processing all YAML files..."
|
||||
FILES_TO_BUILD=$(find . -maxdepth 1 -name "*.yml" -o -name "*.yaml")
|
||||
else
|
||||
echo "Push triggered. Detecting changed files..."
|
||||
FILES_TO_BUILD=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -E '\.(yml|yaml)$' || true)
|
||||
fi
|
||||
for file in $FILES_TO_BUILD; do
|
||||
file=$(echo "$file" | sed 's|^\./||')
|
||||
if [ ! -f "$file" ]; then continue; fi
|
||||
if [[ "$file" == .gitea/* ]]; then continue; fi
|
||||
filename=$(basename -- "$file")
|
||||
image_name="${filename%.*}"
|
||||
echo "---------------------------------------------------"
|
||||
echo "Processing: $file -> Target: registry.chillcog.com/${image_name}:latest"
|
||||
echo "---------------------------------------------------"
|
||||
docker buildx build \
|
||||
--push \
|
||||
--no-cache \
|
||||
-f "$file" \
|
||||
-t "registry.chillcog.com/${image_name}:latest" \
|
||||
.
|
||||
done
|
||||
Reference in new issue
Block a user