-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
80 lines (78 loc) · 2.65 KB
/
Taskfile.yml
File metadata and controls
80 lines (78 loc) · 2.65 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
69
70
71
72
73
74
75
76
77
78
79
80
# https://taskfile.dev
version: '3'
tasks:
tidy:
cmds:
- go mod tidy
silent: true
dev:
desc: "Start live‑reloading dev server (rebuild on change to main.go)"
deps: [tidy]
cmds:
- go tool air # Air will watch *.go by default, thus including main.go
interactive: true
lint:
desc: Run golangci-lint on the codebase
cmds:
- go tool golangci-lint run ./...
test:
desc: Run tests on the codebase
cmds:
- go test -v ./...
clean:
cmds:
- rm -f lsget
lsget:
cmds:
- go build -o lsget ./...
vendor:
desc: "Vendor JavaScript dependencies to reduce supply chain attacks"
cmds:
- mkdir -p assets/js
- curl -fsSL "https://cdn.jsdelivr.net/npm/marked/marked.min.js" -o assets/js/marked.min.js
- curl -fsSL "https://cdn.jsdelivr.net/gh/starfederation/datastar@main/bundles/datastar.js" -o assets/js/datastar.js
- echo "JavaScript dependencies vendored to ./assets/js/"
docker-build:
desc: "Build Docker image locally for testing"
cmds:
- docker build --build-arg VERSION=dev-local -t lsget:local .
- echo "Docker image built successfully as lsget:local"
docker-run:
desc: "Run Docker container locally for testing"
deps: [docker-build]
cmds:
- mkdir -p files logs
- chmod 777 logs # Container runs as UID 65532, needs write access
- echo "Starting lsget container on http://localhost:8080"
- echo "Log file ./logs/access.log"
- docker run --rm -it -p 8080:8080 -v $(pwd)/files:/data -v $(pwd)/logs:/logs -e LSGET_ADDR=0.0.0.0:8080 -e LSGET_DIR=/data -e LSGET_LOGFILE=/logs/access.log lsget:local
docker-test:
desc: "Build and test Docker image (version check)"
cmds:
- docker build --build-arg VERSION=dev-test -t lsget:test .
- docker run --rm lsget:test -version
- echo "✅ Docker image test passed"
docker-compose-up:
desc: "Start services with docker-compose"
cmds:
- mkdir -p files logs
- chmod 777 logs # Container runs as UID 65532, needs write access
- docker-compose up -d
- echo "Services started. Access at http://localhost:8080"
- echo "View logs with task docker-compose-logs"
docker-compose-down:
desc: "Stop services started with docker-compose"
cmds:
- docker-compose down
- echo "Services stopped"
docker-compose-logs:
desc: "View docker-compose logs"
cmds:
- docker-compose logs -f
interactive: true
docker-compose-rebuild:
desc: "Rebuild and restart docker-compose services"
cmds:
- docker-compose down
- docker-compose up -d --build
- echo "Services rebuilt and restarted"