#!/bin/bash
set -e

# Build with BuildKit enabled
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1

# Build the image with caching
docker build \
  --build-arg BUILDKIT_INLINE_CACHE=1 \
  --cache-from type=registry,ref=user/dify:cache \
  --cache-to type=registry,ref=user/dify:cache,mode=max \
  -t dify .