Files
pack/mise.toml
T
3e53630854 feat: respect cache backend type for registry cache import/export, add cache support to build subcommand (#595)
* fix: respect cache backend type for registry cache import/export

* docs: update local development build instructions

- Update local image building to use the provided project task.
- Document the workflow for building with a local registry.
- Add examples for configuring buildctl with caching and debugging flags.

Generated-by: aiautocommit

* refactor(buildkit): clean up code comments and formatting

- Remove redundant comments and improve internal documentation.
- Fix minor formatting inconsistencies in code blocks and comment descriptions.

Generated-by: aiautocommit

* feat: add ParseBool utility to handle common boolean string variants

Generated-by: aiautocommit

* feat: integrate local registry and buildkit configuration

- Add buildkitd configuration to enable HTTP/insecure access to the local registry.
- Introduce a local registry service container on port 7890.
- Update the buildkit setup to mount the new registry configuration.
- Add tasks for building the frontend image and running project builds using the local registry and buildctl.

Generated-by: aiautocommit

* docs: update CLAUDE.md with architecture and style guidance

Generated-by: aiautocommit

* feat: add support for multiple cache-from and cache-to build flags

- Allow users to configure external cache sources and destinations via the `build` subcommand.
- Update cache parsing logic to support multiple entries matching the Docker buildx CLI format.
- Remove hardcoded default cache type to provide better control over BuildKit cache configurations.

Generated-by: aiautocommit

* test: add integration tests for cache-import parsing

Generated-by: aiautocommit

* refactor(buildkit): extract cache entry parsing logic

- Centralize cache configuration logic by moving loop-based parsing into a reusable `cacheEntriesFromFlags` helper.
- Improve code maintainability and readability by reducing duplication in `BuildWithBuildkitClient`.
- Add comprehensive unit tests for cache entry processing, including edge cases for flag parsing and empty inputs.

Generated-by: aiautocommit

* fix(test): remove unused buildkit cache flags from integration tests

* Remove unused flag variables that were meant for remote BuildKit caching.
* Ensure integration tests avoid remote cache (e.g., type=gha) to prevent exceeding GitHub Actions cache limits and excessive eviction.

Generated-by: aiautocommit

* test(buildkit): consolidate cache import tests

- Move TestParseCacheImports from its own file to frontend_test.go to consolidate related buildkit frontend tests.

Generated-by: aiautocommit

* style: fix indentation in build test helper

Generated-by: aiautocommit

* docs: document support for BuildKit cache backends

Generated-by: aiautocommit

* docs(developing-locally): add information on Docker, BuildKit, and caching

- Add missing setup prerequisites.
- Include debugging and configuration guidance for BuildKit/Docker.
- Clarify cache export and import implementation expectations in Railpack.

Generated-by: aiautocommit

* docs: clarify cache flag parsing and pnpm version logic

Generated-by: aiautocommit

---------

Co-authored-by: Matt Van Horn <[email protected]>

Co-authored-by: Michael Bianco <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-13 11:15:16 -06:00

152 lines
4.5 KiB
TOML

[env]
BUILDKIT_HOST = "docker-container://buildkit"
RAILPACK_MISE_VERSION = "{{read_file(path='core/mise/version.txt')}}"
_.path = './bin'
[tools]
go = "1.26"
golangci-lint = "latest"
bun = "1.3"
[settings]
experimental = true
# without this, navigating into various examples/ will output an annoying warning
idiomatic_version_file_enable_tools = ["python", "node", "ruby", "bun"]
# ensures homebrew go, etc doesn't take precedence
activate_aggressive = true
env_shell_expand = true
[tasks.setup]
run = [
"mise install",
"mise run run-buildkit-container",
]
[tasks.run-buildkit-container]
# Mount buildkitd.toml so host.docker.internal:7890 (local registry) is reachable over HTTP
# `.template` ensures it isn't picked up by the mise task management
run = '''
docker rm -f buildkit 2>/dev/null || true
docker run --rm --privileged -d --name buildkit \
-e BUILDKIT_DEBUG=1 \
-v "$PWD/.mise/tasks/buildkitd.toml.template:/etc/buildkit/buildkitd.toml:ro" \
moby/buildkit:latest \
--config /etc/buildkit/buildkitd.toml
'''
[tasks.cli]
run = "go run cmd/cli/main.go"
# run a go debugging against the CLI entrypoint
[tasks.debug-cli]
run = "dlv debug github.com/railwayapp/railpack/cmd/cli --"
# build the CLI binary (`./bin/railpack`) for local use outside the project
[tasks.build]
run = "go build -o bin/railpack cmd/cli/main.go"
[tasks.clean]
run = [
"rm -rf bin dist docs/dist",
"find . -type d -name node_modules -prune -exec rm -rf {} +",
# clean up buildkit cache, avoids cached layers from being used
"docker exec buildkit buildctl prune",
"rm -f *.test",
# stop all railpack containers
"docker stop $(docker ps -q --filter name=railpack)",
# remove all images created by the integration test suite
"docker images 'railpack-test-*' -q | xargs -r docker rmi -f",
# remove images created by manually running `railpack build` against a project example
"find examples -name test.json -exec dirname {} \\; | xargs -n 1 basename | xargs -r -I {} docker rmi -f {}",
"go clean -testcache",
"mise cache clear",
"rm -rf /tmp/railpack",
]
# if a example folder does not have a test.json file, it will be skipped
[tasks.examples-without-tests]
run = "find examples -mindepth 1 -maxdepth 1 -type d ! -exec [ -f \"{}/test.json\" ] \\; -print "
# run unit tests
[tasks.test]
run = "go test -short ./..."
# Runs *all* integration tests. It is extremely slow, do not run this locally.
# Instead, only run the test that you are currently working on:
# `mise run test-integration -- -run "TestExamplesIntegration/config-file"`
[tasks.test-integration]
run = "go test -v ./integration_tests"
# run integration test for the example directory you're currently in
[tasks.test-integration-cwd]
run = """
if [[ ! "$MISE_ORIGINAL_CWD" =~ /examples/ ]]; then
echo "Error: must be run from within an examples/ directory"
exit 1
fi
example_name=$(basename "$MISE_ORIGINAL_CWD")
echo "Running integration test for: $example_name"
go test -v ./integration_tests -run "TestExamplesIntegration/$example_name"
"""
[tasks.run-example-cwd]
run = """
if [[ ! "$MISE_ORIGINAL_CWD" =~ /examples/ ]]; then
echo "Error: must be run from within an examples/ directory"
exit 1
fi
example_name=$(basename "$MISE_ORIGINAL_CWD")
mise run cli --verbose build $MISE_ORIGINAL_CWD --show-plan --progress=plain --env MISE_VERBOSE=1
echo "Running example: 'docker run $example_name'"
"""
# update all test snapshots, if you've updated a example/ project, run this to update the snapshots
[tasks.test-update-snapshots]
run = [
"UPDATE_SNAPS=true go test -short ./...",
"find . -type d -name '__snapshots__' -exec git add -- {} +",
"echo 'test: update snapshots' > $(git rev-parse --git-dir)/COMMIT_EDITMSG",
]
# modernize code using the latest Go fixers
[tasks.fix]
description = "Modernize code using the latest Go fixers"
run = ["golangci-lint run --fix",
"go fix ./..."]
# linting, formatting, and static analysis
[tasks.check]
run = ["go vet ./...", "go fmt ./...", "golangci-lint run", "go mod verify"]
[tasks.upgrade]
description = "Upgrade all Go and Mise packages"
# this task is intentionally run in the same shell so changes caused by version updates are picked up
run = '''
# ensures we are using the latest version of mise locally
mise self-update
# updates lockfiles
mise upgrade --local
eval "$(mise hook-env)"
# get latest go packages
go get -u ./...
go mod tidy
# update packages, respecting semver
cd docs && bun update
'''
# build docs for production
[tasks.docs-build]
dir = "docs"
run = ["bun install --frozen-lockfile", "bun run build"]
[tasks.docs-dev]
dir = "docs"
run = ["bun install", "bun run dev"]