secret/Makefile
sneak 377b51f2db Add Docker support for building and running the CLI tool
- Add DOCKER_HOST export to Makefile for remote Docker daemon
- Create multi-stage Dockerfile:
  - Build stage: golang:1.24-alpine with gcc, make, git
  - Runtime stage: alpine with ca-certificates, gnupg
  - Runs as non-root 'secret' user
- Add Makefile targets:
  - docker: build container as sneak/secret
  - docker-run: run container interactively
- Add .dockerignore to exclude build artifacts but keep .git
  for potential linker flags

Container includes GPG support for PGP unlockers and runs on Linux,
making it suitable for cross-platform testing and deployment.
2025-07-21 22:13:19 +02:00

38 lines
601 B
Makefile

export CGO_ENABLED=1
export DOCKER_HOST := ssh://root@ber1app1.local
default: check
build: ./secret
# Simple build (no code signing needed)
./secret:
go build -v -o $@ cmd/secret/main.go
vet:
go vet ./...
test:
go test ./... || go test -v ./...
fmt:
go fmt ./...
lint:
golangci-lint run --timeout 5m
# Check all code quality (build + vet + lint + unit tests)
check: ./secret vet lint test
# Build Docker container
docker:
docker build -t sneak/secret .
# Run Docker container interactively
docker-run:
docker run --rm -it sneak/secret
# Clean build artifacts
clean:
rm -f ./secret