try different docker params
This commit is contained in:
+25
-11
@@ -93,40 +93,37 @@ jobs:
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY }}
|
||||
|
||||
- name: Build Image Locally
|
||||
- name: Build Image Locally (as true OCI Archive)
|
||||
uses: docker/build-push-action@v6
|
||||
id: build_image
|
||||
with:
|
||||
context: .
|
||||
file: ./Containerfile
|
||||
push: false
|
||||
load: true
|
||||
# Wir schreiben ALLE Tags direkt in ein echtes OCI-Archiv auf die Platte
|
||||
outputs: type=oci,dest=image.tar
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
labels: ${{ steps.metadata.outputs.labels }}
|
||||
|
||||
- name: Push Image via Skopeo (Optimized Archive)
|
||||
- name: Push Image via Skopeo (All Tags)
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
GENERATED_TAGS: ${{ steps.metadata.outputs.tags }}
|
||||
run: |
|
||||
# Die mehrzeiligen Tags in ein Bash-Array umwandeln
|
||||
TAG_LIST=($GENERATED_TAGS)
|
||||
FIRST_TAG=${TAG_LIST[0]}
|
||||
|
||||
echo "Saving image ONCE via $FIRST_TAG to temporary tarball..."
|
||||
docker save "$FIRST_TAG" -o image.tar
|
||||
|
||||
# Jetzt loopen wir NUR den Upload-Schritt über dieselbe Datei
|
||||
# Wir loopen über das OCI-Archiv. Skopeo findet dort jetzt JEDES Tag!
|
||||
for tag in "${TAG_LIST[@]}"; do
|
||||
echo "Pushing and converting $tag to clean OCI format..."
|
||||
echo "Pushing $tag as native OCI to Gitea..."
|
||||
skopeo copy \
|
||||
--format oci \
|
||||
--dest-creds "${{ github.repository_owner }}:${{ secrets.REGISTRY }}" \
|
||||
docker-archive:image.tar \
|
||||
oci-archive:image.tar \
|
||||
docker://$tag
|
||||
done
|
||||
|
||||
# Am Ende sauber aufräumen
|
||||
# Sauber aufräumen
|
||||
rm -f image.tar
|
||||
|
||||
- name: Install envsubst dependencies
|
||||
@@ -158,4 +155,21 @@ jobs:
|
||||
--registry-referrers-mode=legacy \
|
||||
"${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}@${DIGEST}"
|
||||
|
||||
- name: Post-Build Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
echo "Starting safe, server-friendly cleanup..."
|
||||
|
||||
# 1. Entfernt NUR echte verwaiste Zwischenschritte (<none>:<none>)
|
||||
# Niemals getaggte Images (wie deine Registry oder fluffy-pancake)
|
||||
docker system prune -f --volumes
|
||||
|
||||
# 2. Den BuildKit-Cache leeren (Das ist der Haupt-Speicherfresser bei Buildx)
|
||||
docker builder prune -af
|
||||
|
||||
# 3. Temporäre Datei löschen
|
||||
rm -f image.tar
|
||||
|
||||
echo "Cleanup complete. Your server storage is safe!"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user