diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c5edf3d213..bd6150a0d01 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -245,6 +245,7 @@ jobs: run: node common/scripts/install-run-rush.js docker env: DOCKER_CLI_HINTS: false + DOCKER_BUILDKIT: 1 - name: Configure /etc/hosts run: | sudo echo "127.0.0.1 huly.local" | sudo tee -a /etc/hosts @@ -375,6 +376,7 @@ jobs: run: node common/scripts/install-run-rush.js docker env: DOCKER_CLI_HINTS: false + DOCKER_BUILDKIT: 1 - name: Configure /etc/hosts run: | sudo echo "127.0.0.1 huly.local" | sudo tee -a /etc/hosts @@ -469,6 +471,7 @@ jobs: run: node common/scripts/install-run-rush.js docker env: DOCKER_CLI_HINTS: false + DOCKER_BUILDKIT: 1 - name: Configure /etc/hosts run: | sudo echo "127.0.0.1 huly.local" | sudo tee -a /etc/hosts @@ -550,6 +553,7 @@ jobs: run: node common/scripts/install-run-rush.js docker env: DOCKER_CLI_HINTS: false + DOCKER_BUILDKIT: 1 - name: Configure /etc/hosts run: | sudo echo "127.0.0.1 huly.local" | sudo tee -a /etc/hosts @@ -674,6 +678,8 @@ jobs: env: DOCKER_CLI_HINTS: false DOCKER_EXTRA: --platform=linux/amd64,linux/arm64 + DOCKER_BUILDKIT: 1 + DOCKER_BUILD_CLEANUP: true - name: Docker build love-agent run: | cd ./services/ai-bot/love-agent @@ -682,6 +688,7 @@ jobs: env: DOCKER_CLI_HINTS: false DOCKER_EXTRA: --platform=linux/amd64,linux/arm64 + DOCKER_BUILDKIT: 1 - name: Login to Docker Hub if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/s') }} uses: docker/login-action@v3 diff --git a/common/scripts/docker_build.sh b/common/scripts/docker_build.sh index 586eb01750b..2a564dc3751 100755 --- a/common/scripts/docker_build.sh +++ b/common/scripts/docker_build.sh @@ -2,6 +2,33 @@ version=$(git rev-parse HEAD) +# Check for cleanup flag from environment +cleanup=false +if [ "$DOCKER_BUILD_CLEANUP" = "true" ]; then + cleanup=true +fi + echo "Building version: $version" docker build -t "$1" -t "$1:$version" ${DOCKER_EXTRA} . + +if [ "$cleanup" = true ]; then + echo "Cleaning up build artifacts..." + + if [ -d "bundle" ]; then + echo " Removing bundle/" + rm -rf bundle + fi + + if [ -d "dist" ]; then + echo " Removing dist/" + rm -rf dist + fi + + if [ -d ".rush" ]; then + echo " Removing .rush/" + rm -rf .rush + fi + + echo " Size after cleanup: $(du -sh . 2>/dev/null | cut -f1)" +fi diff --git a/dev/tool/Dockerfile b/dev/tool/Dockerfile index c2228521888..7079536dbc8 100644 --- a/dev/tool/Dockerfile +++ b/dev/tool/Dockerfile @@ -1,4 +1,4 @@ -FROM hardcoreeng/base +FROM hardcoreeng/base-slim:v20250916 WORKDIR /usr/src/app COPY bundle/bundle.js ./ diff --git a/services/backup/backup-api-pod/Dockerfile b/services/backup/backup-api-pod/Dockerfile index ebb6e0c8e8b..e74c1c8c5ae 100644 --- a/services/backup/backup-api-pod/Dockerfile +++ b/services/backup/backup-api-pod/Dockerfile @@ -1,4 +1,4 @@ -FROM hardcoreeng/front-base:v20250916 +FROM hardcoreeng/base-slim:v20250916 WORKDIR /app COPY bundle/bundle.js ./ diff --git a/services/billing/pod-billing/Dockerfile b/services/billing/pod-billing/Dockerfile index 15a8d24ddac..e74c1c8c5ae 100644 --- a/services/billing/pod-billing/Dockerfile +++ b/services/billing/pod-billing/Dockerfile @@ -1,4 +1,4 @@ -FROM hardcoreeng/base:v20250916 +FROM hardcoreeng/base-slim:v20250916 WORKDIR /app COPY bundle/bundle.js ./ diff --git a/services/export/pod-export/Dockerfile b/services/export/pod-export/Dockerfile index 5c96aa8e473..1a121895bae 100644 --- a/services/export/pod-export/Dockerfile +++ b/services/export/pod-export/Dockerfile @@ -1,5 +1,5 @@ -FROM hardcoreeng/base:v20250916 +FROM hardcoreeng/base-slim:v20250916 WORKDIR /usr/src/app COPY bundle/bundle.js ./ diff --git a/services/payment/pod-payment/Dockerfile b/services/payment/pod-payment/Dockerfile index 15a8d24ddac..e74c1c8c5ae 100644 --- a/services/payment/pod-payment/Dockerfile +++ b/services/payment/pod-payment/Dockerfile @@ -1,4 +1,4 @@ -FROM hardcoreeng/base:v20250916 +FROM hardcoreeng/base-slim:v20250916 WORKDIR /app COPY bundle/bundle.js ./