mirror of
https://github.com/imjasonh/krust
synced 2026-07-20 21:29:36 +00:00
commit
4112c0af37
3 changed files with 17 additions and 26 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
|
@ -14,6 +14,7 @@ jobs:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, ubuntu-24.04-arm]
|
os: [ubuntu-latest, ubuntu-24.04-arm]
|
||||||
rust: [stable, beta]
|
rust: [stable, beta]
|
||||||
|
|
@ -57,12 +58,10 @@ jobs:
|
||||||
- run: make verify-cross-compile
|
- run: make verify-cross-compile
|
||||||
- run: make build
|
- run: make build
|
||||||
- run: make test
|
- run: make test
|
||||||
- run: make test-e2e
|
|
||||||
# Only run cross-compilation integration test on x86_64 runners
|
|
||||||
- name: Run integration test (cross-compilation)
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
run: make run-built-image
|
|
||||||
|
|
||||||
|
- run: make run-built-image
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
8
Makefile
8
Makefile
|
|
@ -98,13 +98,9 @@ check: check-fmt lint test
|
||||||
|
|
||||||
push-ttl:
|
push-ttl:
|
||||||
@echo "Pushing to ttl.sh..."
|
@echo "Pushing to ttl.sh..."
|
||||||
KRUST_REPO=ttl.sh/jason cargo run build ./example/hello-krust
|
KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust
|
||||||
|
|
||||||
push-gar:
|
|
||||||
@echo "Pushing to gar.sh..."
|
|
||||||
KRUST_REPO=us-central1-docker.pkg.dev/jason-chainguard/krust cargo run build ./example/hello-krust
|
|
||||||
|
|
||||||
run-built-image:
|
run-built-image:
|
||||||
@image=$$(KRUST_REPO=ttl.sh/jason cargo run build ./example/hello-krust) && \
|
@image=$$(KRUST_REPO=ttl.sh/krust cargo run build ./example/hello-krust) && \
|
||||||
echo "Running image: $$image" && \
|
echo "Running image: $$image" && \
|
||||||
docker run --rm $$image
|
docker run --rm $$image
|
||||||
|
|
|
||||||
26
README.md
26
README.md
|
|
@ -19,7 +19,7 @@ krust builds container images for Rust applications without requiring Docker. It
|
||||||
cargo install --path .
|
cargo install --path .
|
||||||
|
|
||||||
# Set up your repository
|
# Set up your repository
|
||||||
export KRUST_REPO=ttl.sh/$USER
|
export KRUST_REPO=<repository-to-push-to>
|
||||||
|
|
||||||
# Build and run your Rust app as a container
|
# Build and run your Rust app as a container
|
||||||
docker run $(krust build)
|
docker run $(krust build)
|
||||||
|
|
@ -90,7 +90,7 @@ krust outputs the pushed image reference by digest to stdout, with all other out
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set your repository prefix
|
# Set your repository prefix
|
||||||
export KRUST_REPO=ttl.sh/jason
|
export KRUST_REPO=<repository-to-push-to>
|
||||||
|
|
||||||
# Build and push (default behavior)
|
# Build and push (default behavior)
|
||||||
krust build
|
krust build
|
||||||
|
|
@ -214,8 +214,7 @@ The tradeoff is that musl has slightly different behavior than glibc in some edg
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
- `KRUST_REPO` - Default repository prefix for built images (e.g., `ttl.sh/username`)
|
- `KRUST_REPO` - Default repository prefix for built images
|
||||||
- `KRUST_IMAGE` - Override the full image reference for a build
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
@ -311,8 +310,8 @@ Example Docker config with various auth methods:
|
||||||
Build and run the example application:
|
Build and run the example application:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set your repository (ttl.sh provides temporary anonymous storage)
|
# Set your repository
|
||||||
export KRUST_REPO=ttl.sh/jason
|
export KRUST_REPO=<repository-to-push-to>
|
||||||
|
|
||||||
# Build and push the example (default behavior)
|
# Build and push the example (default behavior)
|
||||||
krust build example/hello-krust
|
krust build example/hello-krust
|
||||||
|
|
@ -321,15 +320,12 @@ krust build example/hello-krust
|
||||||
krust build example/hello-krust --no-push
|
krust build example/hello-krust --no-push
|
||||||
|
|
||||||
# Build, push, and run the example
|
# Build, push, and run the example
|
||||||
docker run $(krust build example/hello-krust)
|
docker run --rm $(krust build example/hello-krust)
|
||||||
|
|
||||||
# Or specify a custom image name with TTL (time-to-live)
|
# Specify a tag to apply to the image
|
||||||
# Images on ttl.sh expire based on the tag: 1h, 2d, 1w, etc.
|
krust build example/hello-krust --tag v1.2.3
|
||||||
krust build example/hello-krust --image ttl.sh/jason/hello:1h
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: [ttl.sh](https://ttl.sh) is a free, temporary container registry perfect for testing. Images are automatically deleted after their TTL expires.
|
|
||||||
|
|
||||||
## CLI Reference
|
## CLI Reference
|
||||||
|
|
||||||
### Build Command
|
### Build Command
|
||||||
|
|
@ -373,7 +369,7 @@ Options:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Resolve a single file
|
# Resolve a single file
|
||||||
export KRUST_REPO=ttl.sh/myuser
|
export KRUST_REPO=<repository-to-push-to>
|
||||||
krust resolve -f deployment.yaml > resolved.yaml
|
krust resolve -f deployment.yaml > resolved.yaml
|
||||||
|
|
||||||
# Resolve multiple files
|
# Resolve multiple files
|
||||||
|
|
@ -410,7 +406,7 @@ The `resolve` command will:
|
||||||
1. Find all `krust://` references (deduplicates automatically)
|
1. Find all `krust://` references (deduplicates automatically)
|
||||||
2. Build each unique project once
|
2. Build each unique project once
|
||||||
3. Push images to the registry
|
3. Push images to the registry
|
||||||
4. Replace references with concrete digests (e.g., `ttl.sh/user/app@sha256:...`)
|
4. Replace references with concrete digests (i.e., `@sha256:...`)
|
||||||
5. Output resolved YAML to stdout
|
5. Output resolved YAML to stdout
|
||||||
|
|
||||||
**Note**: Multiple references to the same path are deduplicated - the image is built only once and all references are updated with the same digest.
|
**Note**: Multiple references to the same path are deduplicated - the image is built only once and all references are updated with the same digest.
|
||||||
|
|
@ -437,7 +433,7 @@ Options:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build and deploy in one command
|
# Build and deploy in one command
|
||||||
export KRUST_REPO=ttl.sh/myuser
|
export KRUST_REPO=<repository-to-push-to>
|
||||||
krust apply -f deployment.yaml
|
krust apply -f deployment.yaml
|
||||||
|
|
||||||
# Apply entire directory
|
# Apply entire directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue