Update .gitea/workflows/ci.yml
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m1s
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m1s
This commit is contained in:
@@ -10,10 +10,10 @@ env:
|
||||
IMAGE_NAME: tonehaus
|
||||
DOCKERFILE: docker/php/Dockerfile
|
||||
BUILD_TARGET: prod
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
PLATFORMS: linux/amd64
|
||||
|
||||
jobs:
|
||||
build:
|
||||
tonehaus-ci-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -38,28 +38,46 @@ jobs:
|
||||
run: |
|
||||
echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" -u "$REGISTRY_USERNAME" --password-stdin
|
||||
|
||||
- name: Build single-arch images for artifacts (no registry)
|
||||
if: ${{ env.REGISTRY == '' }}
|
||||
- name: Docker Build
|
||||
if: ${{ env.REGISTRY != '' && env.REGISTRY_IMAGE != '' }}
|
||||
env:
|
||||
REGISTRY: ${{ secrets.REGISTRY }}
|
||||
REGISTRY_IMAGE: ${{ secrets.REGISTRY_IMAGE }}
|
||||
run: |
|
||||
TAG_SHA=${{ steps.meta.outputs.short_sha }}
|
||||
for P in linux/amd64; do \
|
||||
ARCH=${P#linux/}; \
|
||||
docker buildx build \
|
||||
--platform "$P" \
|
||||
--file "$DOCKERFILE" \
|
||||
--target "$BUILD_TARGET" \
|
||||
--build-arg APP_ENV=prod \
|
||||
--output type=docker \
|
||||
--tag "$IMAGE_NAME:$TAG_SHA-$ARCH" \
|
||||
. ; \
|
||||
docker save "$IMAGE_NAME:$TAG_SHA-$ARCH" -o "tonehaus-image-$ARCH.tar" ; \
|
||||
done
|
||||
docker buildx build \
|
||||
--platform "$PLATFORMS" \
|
||||
--file "$DOCKERFILE" \
|
||||
--target "$BUILD_TARGET" \
|
||||
--build-arg APP_ENV=prod \
|
||||
--tag "$REGISTRY/$REGISTRY_IMAGE:$TAG_SHA" \
|
||||
--tag "$REGISTRY/$REGISTRY_IMAGE:ci" \
|
||||
--push \
|
||||
.
|
||||
|
||||
- name: Upload artifacts
|
||||
if: ${{ env.REGISTRY == '' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tonehaus-images
|
||||
path: |
|
||||
tonehaus-image-amd64.tar
|
||||
# - name: Build single-arch images for artifacts (no registry)
|
||||
# if: ${{ env.REGISTRY == '' }}
|
||||
# run: |
|
||||
# TAG_SHA=${{ steps.meta.outputs.short_sha }}
|
||||
# for P in $PLATFORMS; do \
|
||||
# ARCH=${P#linux/}; \
|
||||
# docker buildx build \
|
||||
# --platform "$P" \
|
||||
# --file "$DOCKERFILE" \
|
||||
# --target "$BUILD_TARGET" \
|
||||
# --build-arg APP_ENV=prod \
|
||||
# --output type=docker \
|
||||
# --tag "$IMAGE_NAME:$TAG_SHA-$ARCH" \
|
||||
# . ; \
|
||||
# docker save "$IMAGE_NAME:$TAG_SHA-$ARCH" -o "tonehaus-image-$ARCH.tar" ; \
|
||||
# done
|
||||
|
||||
## Artifacts not configured yet..
|
||||
# - name: Upload artifacts
|
||||
# if: ${{ env.REGISTRY == '' }}
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: tonehaus-images
|
||||
# path: |
|
||||
# tonehaus-image-amd64.tar
|
||||
|
||||
|
||||
Reference in New Issue
Block a user