try different docker params
This commit is contained in:
+25
-11
@@ -93,40 +93,37 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.REGISTRY }}
|
password: ${{ secrets.REGISTRY }}
|
||||||
|
|
||||||
- name: Build Image Locally
|
- name: Build Image Locally (as true OCI Archive)
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
id: build_image
|
id: build_image
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Containerfile
|
file: ./Containerfile
|
||||||
push: false
|
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 }}
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
labels: ${{ steps.metadata.outputs.labels }}
|
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'
|
if: github.event_name != 'pull_request'
|
||||||
env:
|
env:
|
||||||
GENERATED_TAGS: ${{ steps.metadata.outputs.tags }}
|
GENERATED_TAGS: ${{ steps.metadata.outputs.tags }}
|
||||||
run: |
|
run: |
|
||||||
# Die mehrzeiligen Tags in ein Bash-Array umwandeln
|
# Die mehrzeiligen Tags in ein Bash-Array umwandeln
|
||||||
TAG_LIST=($GENERATED_TAGS)
|
TAG_LIST=($GENERATED_TAGS)
|
||||||
FIRST_TAG=${TAG_LIST[0]}
|
|
||||||
|
|
||||||
echo "Saving image ONCE via $FIRST_TAG to temporary tarball..."
|
# Wir loopen über das OCI-Archiv. Skopeo findet dort jetzt JEDES Tag!
|
||||||
docker save "$FIRST_TAG" -o image.tar
|
|
||||||
|
|
||||||
# Jetzt loopen wir NUR den Upload-Schritt über dieselbe Datei
|
|
||||||
for tag in "${TAG_LIST[@]}"; do
|
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 \
|
skopeo copy \
|
||||||
--format oci \
|
--format oci \
|
||||||
--dest-creds "${{ github.repository_owner }}:${{ secrets.REGISTRY }}" \
|
--dest-creds "${{ github.repository_owner }}:${{ secrets.REGISTRY }}" \
|
||||||
docker-archive:image.tar \
|
oci-archive:image.tar \
|
||||||
docker://$tag
|
docker://$tag
|
||||||
done
|
done
|
||||||
|
|
||||||
# Am Ende sauber aufräumen
|
# Sauber aufräumen
|
||||||
rm -f image.tar
|
rm -f image.tar
|
||||||
|
|
||||||
- name: Install envsubst dependencies
|
- name: Install envsubst dependencies
|
||||||
@@ -158,4 +155,21 @@ jobs:
|
|||||||
--registry-referrers-mode=legacy \
|
--registry-referrers-mode=legacy \
|
||||||
"${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}@${DIGEST}"
|
"${{ 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