Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ outputs:
new_tag:
description: "The new tag which was generated"
value: ${{ steps.generate-and-push-tag.outputs.new_tag }}
runs-on: ubuntu-latest
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing because its invalid in using: 'composite'

runs:
using: 'composite'
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host
- name: Build And Push Tag
id: generate-and-push-tag
run: |
Expand Down
28 changes: 24 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,33 @@ else
fi
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT

# Set up Docker Buildx for optimized builds
docker buildx create --use --driver docker-container --name multiarch --bootstrap 2>/dev/null || docker buildx use multiarch

docker login --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASSWORD

echo "Building optimized Docker image with registry caching...";
# Use registry cache for better compatibility with composite actions
CACHE_TAG="$DOCKERHUB_USERNAME/$IMAGE_NAME:buildcache"

if [ -n "$SENTRY_AUTH_TOKEN" ]; then
docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG --build-arg SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" .
docker buildx build \
--platform linux/amd64 \
--cache-from type=registry,ref=$CACHE_TAG \
--cache-to type=registry,ref=$CACHE_TAG,mode=max \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--build-arg SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" \
-t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG \
--push .
else
docker build -t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG .
docker buildx build \
--platform linux/amd64 \
--cache-from type=registry,ref=$CACHE_TAG \
--cache-to type=registry,ref=$CACHE_TAG,mode=max \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG \
--push .
fi
echo "Pushing Docker Image to Docker Hub";
docker push $DOCKERHUB_USERNAME/$IMAGE_NAME:$NEW_TAG

echo "NEW_TAG=v$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "New tag: $NEW_TAG";