Commit 755d4a7

benny-dou <60535774+benny-dou@users.noreply.github.com>
2025-03-06 04:59:29
build: update actions
1 parent 5625996
Changed files (3)
.github
docker
.github/workflows/baseimg.yml
@@ -22,6 +22,22 @@ jobs:
       - name: Checkout
         uses: actions/checkout@main
 
+      - name: Docker meta
+        id: meta
+        uses: docker/metadata-action@master
+        with:
+          images: ghcr.io/${{ github.repository }}
+          flavor: |
+            prefix=base-
+          tags: |
+            type=ref,event=branch
+            type=ref,event=pr
+            type=sha,prefix=base-,format=long
+            type=semver,pattern=v{{version}}
+            type=semver,pattern=v{{major}}.{{minor}}
+            type=semver,pattern=v{{major}}
+            type=raw,value=latest,enable={{is_default_branch}}
+
       - name: Set up QEMU
         uses: docker/setup-qemu-action@master
 
@@ -39,8 +55,9 @@ jobs:
         with:
           context: .
           file: docker/base.Dockerfile
-          cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:build-cache
-          cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:build-cache,mode=max
+          cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:base-cache
+          cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:base-cache,mode=max
           platforms: linux/amd64
-          push: ${{ github.ref == 'refs/heads/main' }}
-          tags: ghcr.io/${{ github.repository }}:base
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
.github/workflows/docker.yml
@@ -61,6 +61,6 @@ jobs:
           build-args: |
             IMAGE_NAME=ghcr.io/${{ github.repository }}
           platforms: linux/amd64
-          push: ${{ github.ref == 'refs/heads/main' }}
+          push: true
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
docker/Dockerfile
@@ -1,5 +1,5 @@
 ARG IMAGE_NAME
-FROM $IMAGE_NAME:base
+FROM $IMAGE_NAME:base-latest
 COPY --chown=abc src /app
 WORKDIR /app
 CMD ["with-contenv", "s6-setuidgid", "abc", "python", "/app/main.py"]