|
| 1 | +.PHONY: build-cache build install-act run-github run-local clean-vscode clean |
| 2 | + |
| 3 | +build-cache: |
| 4 | + @echo "Building SageMaker Code Editor (multi-stage npm cache)..." |
| 5 | + docker buildx build \ |
| 6 | + --platform linux/amd64 \ |
| 7 | + --progress=plain \ |
| 8 | + --memory=32g \ |
| 9 | + -t npm-cache:latest \ |
| 10 | + -f scripts/Dockerfile.build.cache . |
| 11 | + |
| 12 | +build: |
| 13 | + @echo "Building SageMaker Code Editor (original)..." |
| 14 | + docker buildx build \ |
| 15 | + --platform linux/amd64 \ |
| 16 | + --progress=plain \ |
| 17 | + --memory=32g \ |
| 18 | + --output type=local,dest=./.artifacts \ |
| 19 | + -t localbuild:latest \ |
| 20 | + -f scripts/Dockerfile.build . |
| 21 | + |
| 22 | +install-act: |
| 23 | + @echo "Installing act (GitHub Actions runner)..." |
| 24 | + @if ! command -v act >/dev/null 2>&1 && [ ! -f ./bin/act ]; then \ |
| 25 | + curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | bash; \ |
| 26 | + echo "act installed successfully"; \ |
| 27 | + else \ |
| 28 | + echo "act is already available"; \ |
| 29 | + fi |
| 30 | + |
| 31 | +run-github: install-act |
| 32 | + @echo "Running complete GitHub Actions workflow locally..." |
| 33 | + @echo "Available workflows:" |
| 34 | + @ls -la .github/workflows/ |
| 35 | + @echo "" |
| 36 | + @echo "Running full build.yml workflow..." |
| 37 | + @if command -v act >/dev/null 2>&1; then \ |
| 38 | + act push -W .github/workflows/build.yml --platform ubuntu-22.04=catthehacker/ubuntu:act-22.04 --container-options "--memory=32g --memory-swap=32g"; \ |
| 39 | + else \ |
| 40 | + ./bin/act push -W .github/workflows/build.yml --platform ubuntu-22.04=catthehacker/ubuntu:act-22.04 --container-options "--memory=32g --memory-swap=32g"; \ |
| 41 | + fi |
| 42 | + |
| 43 | +run-local: |
| 44 | + @if [ -z "$(TARBALL)" ]; then \ |
| 45 | + echo "Building and running SageMaker Code Editor locally on port 8888..."; \ |
| 46 | + docker build -f scripts/Dockerfile.dev -t local-code-editor-dev . || exit 1; \ |
| 47 | + echo "Stopping container..."; \ |
| 48 | + docker stop local-code-editor-dev; \ |
| 49 | + sleep 2; \ |
| 50 | + echo "Starting container on http://localhost:8888"; \ |
| 51 | + docker run --rm -d -p 8888:8000 -v .:/workspace -u $(id -u):$(id -g) --entrypoint /workspace/scripts/run-code-editor-dev.sh --name local-code-editor-dev local-code-editor-dev || exit 1; \ |
| 52 | + docker logs -f local-code-editor-dev; \ |
| 53 | + else \ |
| 54 | + echo "Building and running SageMaker Code Editor locally on port 8888..."; \ |
| 55 | + docker build -f scripts/Dockerfile.run --build-arg TARBALL=$(TARBALL) -t local-code-editor . || exit 1; \ |
| 56 | + echo "Stopping container..."; \ |
| 57 | + docker stop local-code-editor; \ |
| 58 | + sleep 2; \ |
| 59 | + echo "Starting container on http://localhost:8888"; \ |
| 60 | + docker run --rm -d -p 8888:8000 --name local-code-editor local-code-editor || exit 1; \ |
| 61 | + docker logs -f local-code-editor; \ |
| 62 | + fi |
| 63 | + |
| 64 | +clean-vscode: |
| 65 | + @echo "Cleaning VSCode node_modules..." |
| 66 | + @find . -type d -name "node_modules" -exec rm -rf {} + 2>/dev/null || true |
| 67 | + @rm -rf vscode/out/* 2>/dev/null || true |
| 68 | + @echo "VSCode cleanup completed" |
| 69 | + |
| 70 | +clean: clean-vscode |
| 71 | + @echo "Cleaning act temporary files and Docker images..." |
| 72 | + @echo "Removing act cache..." |
| 73 | + @rm -rf ~/.cache/act 2>/dev/null || true |
| 74 | + @echo "Act cleanup completed" |
| 75 | + |
| 76 | +reset-vscode: |
| 77 | + @echo "Resetting vscode submodule..." |
| 78 | + git submodule update --init --recursive |
| 79 | + git submodule foreach --recursive "git reset --hard HEAD && sudo git clean -fd" |
| 80 | + @echo "Resetting patches..." |
| 81 | + sudo rm -rf .pc/* |
| 82 | + |
0 commit comments