github: 添加docker action

This commit is contained in:
CDCDDCDC
2025-06-07 00:34:04 +08:00
parent 02ffa57069
commit b59e54fe4d
10 changed files with 141 additions and 20 deletions

57
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
# 此工作流使用未经 GitHub 认证的操作。
# 它们由第三方提供,并受
# 单独的服务条款、隐私政策和支持
# 文档。
# GitHub 建议将操作固定到提交 SHA。
# 若要获取较新版本,需要更新 SHA。
# 还可以引用标记或分支,但该操作可能会更改而不发出警告。
name: Publish V5 Docker image
on:
push:
tags:
- "v5.*.*"
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: cdcddcdc/m7s-jt1078
- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v2
# with:
# subject-name: index.docker.io/my-docker-hub-namespace/my-docker-hub-repository
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true

View File

@@ -3,7 +3,7 @@ name: release-macos
on:
push:
tags:
- "v*.*.*"
- "v1.*.*"
jobs:
build-macos: #https://github.com/softprops/action-gh-release

View File

@@ -3,7 +3,7 @@ name: release-ubuntu
on:
push:
tags:
- "v*.*.*"
- "v1.*.*"
jobs:
build-ubuntu:

View File

@@ -3,7 +3,7 @@ name: release-windows
on:
push:
tags:
- "v*.*.*"
- "v1.*.*"
jobs:
build-windows: #https://github.com/softprops/action-gh-release

12
Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM golang:1.23-alpine AS builder
WORKDIR /app
COPY . .
RUN cd ./example/jt1078 && go build -o jt1078
FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache ca-certificates && update-ca-certificates
COPY --from=builder /app/example/jt1078/jt1078 .
COPY --from=builder /app/example/jt1078/docker_config.yaml ./config.yaml
EXPOSE 12079 12081 12051 12052
CMD ["./jt1078"]

View File

@@ -1,11 +1,11 @@
global:
http:
listenaddr: :12079
listenaddrtls: :12080 # 用于HTTPS方式访问API的端口配置
certfile: "go-jt808.online.crt"
keyfile: "go-jt808.online.key"
listen_addr: ":12079"
listen_addr_tls: ":12080" # 用于HTTPS方式访问API的端口配置
cert_file: "go-jt808.online.crt"
key_file: "go-jt808.online.key"
tcp:
listenaddr: :12081
listen_addr: ":12081"
jt1078:
enable: true
@@ -14,22 +14,22 @@ jt1078:
enable: true # 是否启用 用于双向对讲
jt1078webrtc:
port: 12020 # 对讲默认udp端口
ip: 124.221.30.46 # 外网ip 用于SDP协商修改
audioports: [12021, 12050] # 音频端口 [min,max]
onjoinurl: "https://127.0.0.1:12000/api/v1/jt808/event/join-audio" # 设备连接到音频端口的回调
onleaveurl: "https://127.0.0.1:12000/api/v1/jt808/event/leave-audio" # 设备断开了音频端口的回调
overtimesecond: 60 # 多久没有下发对讲语言的数据 就关闭这个链接
ip: "124.221.30.46" # 外网ip 用于SDP协商修改
audio_ports: [12021, 12050] # 音频端口范围 [min,max]
on_join_url: "https://127.0.0.1:12000/api/v1/jt808/event/join-audio" # 设备连接到音频端口的回调
on_leave_url: "https://127.0.0.1:12000/api/v1/jt808/event/leave-audio" # 设备断开了音频端口的回调
overtime_second: 60 # 多久没有下发对讲语言的数据 就关闭这个链接
realtime: # 实时视频
addr: '0.0.0.0:12051'
onjoinurl: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-join"
onleaveurl: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-leave"
on_join_url: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-join"
on_leave_url: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-leave"
prefix: "live/jt1078" # 默认自定义前缀-手机号-通道 如live/jt1078-295696659617-1
playback: # 回放视频
addr: '0.0.0.0:12052'
onjoinurl: "https://127.0.0.1:12000/api/v1/play-back-join"
onleaveurl: "https://127.0.0.1:12000/api/v1/play-back-leave"
on_join_url: "https://127.0.0.1:12000/api/v1/play-back-join"
on_leave_url: "https://127.0.0.1:12000/api/v1/play-back-leave"
prefix: "live/jt1079" # 默认自定义前缀-手机号-通道 如live/jt1079-295696659617-1
simulations:

View File

@@ -0,0 +1,43 @@
global:
http:
listen_addr: ":12079"
# listen_addr_tls: ":12080" # 用于HTTPS方式访问API的端口配置
# cert_file: "go-jt808.online.crt"
# key_file: "go-jt808.online.key"
tcp:
listen_addr: ":12081"
jt1078:
enable: true
intercom:
enable: false # 是否启用 用于双向对讲
jt1078webrtc:
port: 12020 # 对讲默认udp端口
ip: "124.221.30.46" # 外网ip 用于SDP协商修改
audio_ports: [12021, 12050] # 音频端口范围 [min,max]
on_join_url: "https://127.0.0.1:12000/api/v1/jt808/event/join-audio" # 设备连接到音频端口的回调
on_leave_url: "https://127.0.0.1:12000/api/v1/jt808/event/leave-audio" # 设备断开了音频端口的回调
overtime_second: 60 # 多久没有下发对讲语言的数据 就关闭这个链接
realtime: # 实时视频
addr: '0.0.0.0:12051'
on_join_url: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-join"
on_leave_url: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-leave"
prefix: "live/jt1078" # 默认自定义前缀-手机号-通道 如live/jt1078-295696659617-1
playback: # 回放视频
addr: '0.0.0.0:12052'
on_join_url: "https://127.0.0.1:12000/api/v1/play-back-join"
on_leave_url: "https://127.0.0.1:12000/api/v1/play-back-leave"
prefix: "live/jt1079" # 默认自定义前缀-手机号-通道 如live/jt1079-295696659617-1
simulations:
# jt1078文件 默认循环发送
- name: ../testdata/data.txt
addr: 127.0.0.1:12051 # 模拟实时
- name: ../testdata/audio_data.txt
addr: 127.0.0.1:12052 # 模拟回放
mp4:
enable: true

View File

@@ -4,10 +4,11 @@ go 1.24.0
require (
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.6.0
m7s.live/v5 v5.0.1
m7s.live/v5 v5.0.2
)
require (
github.com/alchemy/rotoslog v0.2.2 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bluenviron/mediacommon v1.14.0 // indirect

View File

@@ -1,3 +1,5 @@
github.com/alchemy/rotoslog v0.2.2 h1:yzAOjaQBKgJvAdPi0sF5KSPMq5f2vNJZEnPr73CPDzQ=
github.com/alchemy/rotoslog v0.2.2/go.mod h1:pOHF0DKryPLaQzjcUlidLVRTksvk9yW75YIu1yYiiEQ=
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -166,6 +168,12 @@ github.com/quic-go/quic-go v0.50.1 h1:unsgjFIUqW8a2oopkY7YNONpV1gYND6Nt9hnt1PN94
github.com/quic-go/quic-go v0.50.1/go.mod h1:Vim6OmUvlYdwBhXP9ZVrtGmCMWa3wEqhq3NgYrI8b4E=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/samber/lo v1.44.0 h1:5il56KxRE+GHsm1IR+sZ/6J42NODigFiqCWpSc2dybA=
github.com/samber/lo v1.44.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/samber/slog-formatter v1.0.0 h1:ULxHV+jNqi6aFP8xtzGHl2ejFRMl2+jI2UhCpgoXTDA=
github.com/samber/slog-formatter v1.0.0/go.mod h1:c7pRfwhCfZQNzJz+XirmTveElxXln7M0Y8Pq781uxlo=
github.com/samber/slog-multi v1.0.0 h1:snvP/P5GLQ8TQh5WSqdRaxDANW8AAA3egwEoytLsqvc=
github.com/samber/slog-multi v1.0.0/go.mod h1:uLAvHpGqbYgX4FSL0p1ZwoLuveIAJvBECtE07XmYvFo=
github.com/shirou/gopsutil/v4 v4.24.8 h1:pVQjIenQkIhqO81mwTaXjTzOMT7d3TZkf43PlVFHENI=
github.com/shirou/gopsutil/v4 v4.24.8/go.mod h1:wE0OrJtj4dG+hYkxqDH3QiBICdKSf04/npcvLLc/oRg=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
@@ -307,5 +315,5 @@ gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkw
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
m7s.live/v5 v5.0.1 h1:cVE+7bIkb2CN5Lseg2TdaT4bZHxudbGfVR542eZPGDc=
m7s.live/v5 v5.0.1/go.mod h1:l97n+QqYXFjY++BnmpsMYemZSIf58ARh6VJLNWmi9JE=
m7s.live/v5 v5.0.2 h1:QpKm5WNkJNvaRnblelqTZGik7P7IsImjlHwnf9cSow8=
m7s.live/v5 v5.0.2/go.mod h1:qpLysNpSNVxPgzRVcvOqKAQxWpefd9lRzDbQn+ZhRCY=

0
go.sum Normal file
View File