Skip to content

Commit 34d34e1

Browse files
committed
Update README.md to reference the latest Docker image for tsflow and streamline the standalone Docker instructions.
1 parent dac84c9 commit 34d34e1

File tree

2 files changed

+188
-7
lines changed

2 files changed

+188
-7
lines changed

.github/workflows/build.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
release:
9+
types: [ published ]
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: rajsinghtech/tsflow
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: '1.21'
25+
26+
- name: Cache Go modules
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/go/pkg/mod
30+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
31+
restore-keys: |
32+
${{ runner.os }}-go-
33+
34+
- name: Download dependencies
35+
run: go mod download
36+
37+
- name: Run tests
38+
run: go test -v ./...
39+
40+
- name: Run go vet
41+
run: go vet ./...
42+
43+
build:
44+
needs: test
45+
runs-on: ubuntu-latest
46+
permissions:
47+
contents: read
48+
packages: write
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Set up Go
55+
uses: actions/setup-go@v4
56+
with:
57+
go-version: '1.21'
58+
59+
- name: Cache Go modules
60+
uses: actions/cache@v3
61+
with:
62+
path: ~/go/pkg/mod
63+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
64+
restore-keys: |
65+
${{ runner.os }}-go-
66+
67+
- name: Download dependencies
68+
run: go mod download
69+
70+
- name: Build binaries
71+
run: |
72+
# Build for multiple platforms
73+
GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o tsflow-linux-amd64 .
74+
GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o tsflow-linux-arm64 .
75+
GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o tsflow-darwin-amd64 .
76+
GOOS=darwin GOARCH=arm64 go build -ldflags="-w -s" -o tsflow-darwin-arm64 .
77+
GOOS=windows GOARCH=amd64 go build -ldflags="-w -s" -o tsflow-windows-amd64.exe .
78+
79+
# Make them executable
80+
chmod +x tsflow-*
81+
82+
- name: Log in to Container Registry
83+
if: github.event_name != 'pull_request'
84+
uses: docker/login-action@v3
85+
with:
86+
registry: ${{ env.REGISTRY }}
87+
username: ${{ github.actor }}
88+
password: ${{ secrets.GH_TOKEN }}
89+
90+
- name: Extract metadata
91+
id: meta
92+
uses: docker/metadata-action@v5
93+
with:
94+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
95+
tags: |
96+
type=ref,event=branch
97+
type=ref,event=pr
98+
type=semver,pattern={{version}}
99+
type=semver,pattern={{major}}.{{minor}}
100+
type=raw,value=latest,enable={{is_default_branch}}
101+
102+
- name: Set up Docker Buildx
103+
uses: docker/setup-buildx-action@v3
104+
105+
- name: Build and push Docker image
106+
if: github.event_name != 'pull_request'
107+
uses: docker/build-push-action@v5
108+
with:
109+
context: .
110+
platforms: linux/amd64,linux/arm64
111+
push: true
112+
tags: ${{ steps.meta.outputs.tags }}
113+
labels: ${{ steps.meta.outputs.labels }}
114+
cache-from: type=gha
115+
cache-to: type=gha,mode=max
116+
117+
- name: Upload binaries as artifacts
118+
uses: actions/upload-artifact@v3
119+
with:
120+
name: tsflow-binaries
121+
path: |
122+
tsflow-*
123+
retention-days: 30
124+
125+
release:
126+
if: github.event_name == 'release'
127+
needs: build
128+
runs-on: ubuntu-latest
129+
permissions:
130+
contents: write
131+
132+
steps:
133+
- name: Checkout repository
134+
uses: actions/checkout@v4
135+
136+
- name: Download artifacts
137+
uses: actions/download-artifact@v3
138+
with:
139+
name: tsflow-binaries
140+
path: ./binaries
141+
142+
- name: Create release archives
143+
run: |
144+
cd binaries
145+
# Create archives for each platform
146+
tar -czf tsflow-linux-amd64.tar.gz tsflow-linux-amd64
147+
tar -czf tsflow-linux-arm64.tar.gz tsflow-linux-arm64
148+
tar -czf tsflow-darwin-amd64.tar.gz tsflow-darwin-amd64
149+
tar -czf tsflow-darwin-arm64.tar.gz tsflow-darwin-arm64
150+
zip tsflow-windows-amd64.zip tsflow-windows-amd64.exe
151+
152+
# Create checksums
153+
sha256sum *.tar.gz *.zip > checksums.txt
154+
155+
- name: Upload release assets
156+
uses: softprops/action-gh-release@v1
157+
with:
158+
files: |
159+
binaries/*.tar.gz
160+
binaries/*.zip
161+
binaries/checksums.txt
162+
body: |
163+
## TSFlow ${{ github.ref_name }}
164+
165+
### Installation
166+
167+
#### Docker
168+
```bash
169+
docker pull ghcr.io/rajsinghtech/tsflow:${{ github.ref_name }}
170+
docker run -p 8080:8080 \
171+
-e TAILSCALE_ACCESS_TOKEN="your-token" \
172+
-e TAILSCALE_TAILNET="your-tailnet" \
173+
ghcr.io/rajsinghtech/tsflow:${{ github.ref_name }}
174+
```
175+
176+
#### Binary Download
177+
Download the appropriate binary for your platform from the assets below.
178+
179+
### Checksums
180+
Verify your download with the provided checksums.txt file.
181+
draft: false
182+
prerelease: false
183+
env:
184+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ go build -o tsflow && ./tsflow -token "INSERT" -tailnet "INSERT"
3737
docker run -p 8080:8080 \
3838
-e TAILSCALE_ACCESS_TOKEN="INSERT" \
3939
-e TAILSCALE_TAILNET="INSERT" \
40-
tsflow:latest
40+
ghcr.io/rajsinghtech/tsflow:latest
4141
```
4242

4343
### Configuration
@@ -161,7 +161,7 @@ Communication through subnet routers to access local networks and resources.
161161
version: '3.8'
162162
services:
163163
tsflow:
164-
build: .
164+
image: ghcr.io/rajsinghtech/tsflow:latest
165165
ports:
166166
- "8080:8080"
167167
environment:
@@ -181,14 +181,11 @@ docker-compose up -d
181181

182182
### Standalone Docker
183183
```bash
184-
# Build
185-
docker build -t tsflow .
186-
187-
# Run
184+
# Run latest version
188185
docker run -d \
189186
--name tsflow \
190187
-p 8080:8080 \
191188
-e TAILSCALE_ACCESS_TOKEN="your-token" \
192189
-e TAILSCALE_TAILNET="your-tailnet" \
193-
tsflow:latest
190+
ghcr.io/rajsinghtech/tsflow:latest
194191
```

0 commit comments

Comments
 (0)