feat: 修改了构建脚本
Some checks failed
Build and Push Docker Image to Aliyun Registry / build-and-push (push) Has been cancelled

Signed-off-by: Caijinglong <cjl_spy@163.com>
This commit is contained in:
Caijinglong 2025-06-26 10:25:29 +08:00
parent d28d5e91d3
commit 453b38bbc9
Signed by: cai
GPG Key ID: 92FBD82121AC80AA
3 changed files with 41 additions and 8 deletions

View File

@ -13,7 +13,8 @@ on:
env:
REGISTRY: ${{ secrets.ALIYUN_REGISTRY }}
IMAGE_NAME: ${{ secrets.IMAGE_NAME || github.repository }}
IMAGE_NAME: ${{ secrets.IMAGE_NAME || 'common-nginx-fpm' }}
NAMESPACE: ${{ secrets.ALIYUN_NAMESPACE }}
jobs:
build-and-push:
@ -50,10 +51,36 @@ jobs:
org.opencontainers.image.title=Common Nginx PHP-FPM
org.opencontainers.image.description=A common Nginx + PHP-FPM Docker image with Alpine Linux
org.opencontainers.image.vendor=Common Docker Images
- name: Debug registry information
run: |
echo "Registry: ${{ env.REGISTRY }}"
echo "Image Name: ${{ env.IMAGE_NAME }}"
echo "Full Image: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}"
echo "Generated Tags:"
echo "${{ steps.meta.outputs.tags }}"
- name: Build and push Docker image
- name: Build Docker image
uses: docker/build-push-action@v5
id: build
with:
context: .
file: ./Dockerfile
push: false
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: |
type=gha
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: |
type=gha,mode=max
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
- name: Push Docker image
uses: docker/build-push-action@v5
id: push
with:
context: .
file: ./Dockerfile
@ -61,11 +88,16 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: |
type=gha
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}
- name: Build and Push Results
run: |
echo "✅ Build completed successfully!"
echo "Build digest: ${{ steps.build.outputs.digest }}"
echo "✅ Push completed successfully!"
echo "Push digest: ${{ steps.push.outputs.digest }}"
- name: Update deployment status
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
logs/

View File

@ -1,3 +1,3 @@
VERSION="1.0.0"
docker build -t common-nginx-fpm:$VERSION .
VERSION="0.1.2"
docker buildx build --platform linux/amd64 -t common-nginx-fpm:$VERSION .
docker tag common-nginx-fpm:$VERSION common-nginx-fpm:latest