Skip to content

Commit ea693fa

Browse files
bordeuxclaude
andcommitted
docs: update Docker usage to binary extraction pattern
Update README to follow gomplate pattern where Docker image is used to extract the binary rather than running templates inside containers. ## Changes ### Quick Start Section - Remove docker run examples with volume mounts - Add Dockerfile multi-stage build example - Show COPY --from pattern for binary extraction - Clearer for CI/CD use cases ### Docker Installation Section - Document multi-stage build pattern - Add Dockerfile example with tmpltool usage - List available tags and multi-arch support - Add local binary extraction instructions ### Features Section - Change "Docker Support" to "Docker-Friendly" - Emphasize binary extraction pattern - Highlight static binary availability ## Benefits This pattern is better for: - CI/CD pipelines (no volume mounts needed) - Reproducible builds (binary in image) - Smaller final images (just the binary) - Standard practice (similar to gomplate, dockerize, etc.) ## Example Usage ```dockerfile FROM ghcr.io/bordeux/tmpltool:latest AS tmpltool FROM alpine:latest COPY --from=tmpltool /tmpltool /usr/local/bin/tmpltool RUN tmpltool config.tmpl -o config.json ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 11a7416 commit ea693fa

1 file changed

Lines changed: 38 additions & 26 deletions

File tree

README.md

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,24 @@ A fast and simple command-line template rendering tool using [MiniJinja](https:/
4141
Get started in 30 seconds:
4242

4343
```bash
44-
# Download for your platform (or use Docker)
45-
docker pull ghcr.io/bordeux/tmpltool:latest
46-
47-
# Create a simple template
48-
cat > greeting.tmpl << 'EOF'
49-
Hello {{ get_env(name="USER", default="World") }}!
44+
# Download binary for your platform from releases
45+
# https://github.com/bordeux/tmpltool/releases
46+
47+
# Or use Docker to copy the binary (recommended for CI/CD):
48+
# Create a Dockerfile to extract the binary
49+
cat > Dockerfile << 'EOF'
50+
FROM ghcr.io/bordeux/tmpltool:latest AS tmpltool
51+
FROM alpine:latest
52+
COPY --from=tmpltool /tmpltool /usr/local/bin/tmpltool
5053
EOF
5154

52-
# Render it
53-
docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/bordeux/tmpltool:latest greeting.tmpl
54-
# Output: Hello World!
55-
56-
# Or with your own name
57-
docker run --rm -e USER=Alice -v $(pwd):/workspace -w /workspace ghcr.io/bordeux/tmpltool:latest greeting.tmpl
58-
# Output: Hello Alice!
59-
```
60-
61-
**Without Docker:**
62-
```bash
63-
# Install binary from releases
64-
# See Installation section below
55+
docker build -t myapp .
56+
# Now tmpltool is available in your image at /usr/local/bin/tmpltool
6557

6658
# Create and render template
6759
echo 'Hello {{ get_env(name="USER", default="World") }}!' > greeting.tmpl
6860
tmpltool greeting.tmpl
61+
# Output: Hello World!
6962
```
7063

7164
## Features
@@ -83,8 +76,8 @@ tmpltool greeting.tmpl
8376
- **Security**: Built-in protections with optional `--trust` mode
8477
- **Flexible I/O**: File or stdin input, file or stdout output
8578
- **Full Jinja2 Syntax**: Conditionals, loops, filters, and more
86-
- **Single Binary**: No runtime dependencies
87-
- **Docker Support**: Multi-arch images available
79+
- **Single Binary**: No runtime dependencies, static binaries available
80+
- **Docker-Friendly**: Extract binary from Docker image (multi-arch support)
8881

8982
## Installation
9083

@@ -107,16 +100,35 @@ chmod +x /usr/local/bin/tmpltool
107100

108101
### Using Docker
109102

110-
Pull from GitHub Container Registry:
103+
Docker images are available for extracting the binary into your own images (similar to gomplate pattern):
111104

112-
```bash
113-
docker pull ghcr.io/bordeux/tmpltool:latest
105+
**In Your Dockerfile:**
106+
```dockerfile
107+
# Multi-stage build to copy tmpltool binary
108+
FROM ghcr.io/bordeux/tmpltool:latest AS tmpltool
109+
110+
FROM alpine:latest
111+
# Copy the binary from the tmpltool image
112+
COPY --from=tmpltool /tmpltool /usr/local/bin/tmpltool
113+
114+
# Now use tmpltool in your build process
115+
COPY config.tmpl /app/
116+
RUN tmpltool /app/config.tmpl -o /app/config.json --validate json
114117
```
115118

116-
Create a shell alias for convenience:
119+
**Available Tags:**
120+
- `latest` - Latest stable release
121+
- `v1.x.x` - Specific version tags
122+
- Multi-arch support: `linux/amd64`, `linux/arm64`
117123

124+
**For Local Testing:**
118125
```bash
119-
alias tmpltool='docker run --rm -v $(pwd):/workspace -w /workspace ghcr.io/bordeux/tmpltool:latest'
126+
# Extract binary to local system
127+
docker create --name tmpltool-tmp ghcr.io/bordeux/tmpltool:latest
128+
docker cp tmpltool-tmp:/tmpltool ./tmpltool
129+
docker rm tmpltool-tmp
130+
chmod +x ./tmpltool
131+
./tmpltool --version
120132
```
121133

122134
### From Source

0 commit comments

Comments
 (0)