-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
68 lines (54 loc) · 1.62 KB
/
justfile
File metadata and controls
68 lines (54 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
version := `git describe --tags --always --dirty 2>/dev/null || echo dev`
binary := "coldkey"
image := "ghcr.io/pike00/coldkey"
goflags := "-trimpath -ldflags=\"-s -w -X main.version=" + version + "\""
security_flags := "--network none --read-only --cap-drop ALL --security-opt no-new-privileges:true --tmpfs /tmp:rw,noexec,nosuid,size=10m"
# Build the binary
build:
CGO_ENABLED=0 go build {{goflags}} -o {{binary}} ./cmd/coldkey
# Run tests
test:
go test -race -count=1 ./...
# Run golangci-lint
lint:
golangci-lint run ./...
# Run go vet
vet:
go vet ./...
# Check formatting
fmt:
gofumpt -l -d .
# Build Docker image
docker:
docker build --build-arg VERSION={{version}} -t {{image}}:{{version}} -t {{image}}:latest .
# Run interactively in Docker (secure defaults)
docker-run:
@mkdir -p output
docker run --rm -it {{security_flags}} \
-u $(id -u):$(id -g) \
-v $(pwd)/output:/out \
{{image}}:latest
# Create backup from existing key via Docker
docker-backup KEYFILE:
@mkdir -p output
docker run --rm {{security_flags}} \
-u $(id -u):$(id -g) \
-v {{KEYFILE}}:/keys/keys.txt:ro \
-v $(pwd)/output:/out \
{{image}}:latest backup -o /out/backup.html /keys/keys.txt
# Push Docker image to ghcr.io
push: docker
docker push {{image}}:{{version}}
docker push {{image}}:latest
# Tag a release and push (triggers CI release workflow)
release TAG:
git tag {{TAG}}
git push origin {{TAG}}
# Record asciinema demo
demo:
./demo/record.sh
# Remove build artifacts
clean:
rm -f {{binary}}
# Full CI pipeline
ci: vet test build docker