Skip to content

Commit 71c59cf

Browse files
committed
Add rockchip docker image
1 parent 0e49a06 commit 71c59cf

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,58 @@ jobs:
223223
labels: ${{ steps.meta-hw.outputs.labels }}
224224
cache-from: type=gha
225225
cache-to: type=gha,mode=max
226+
227+
docker-rockchip:
228+
name: Build docker rockchip
229+
runs-on: ubuntu-latest
230+
steps:
231+
- name: Checkout
232+
uses: actions/checkout@v4
233+
234+
- name: Docker meta
235+
id: meta-rk
236+
uses: docker/metadata-action@v5
237+
with:
238+
images: |
239+
${{ github.repository }}
240+
ghcr.io/${{ github.repository }}
241+
flavor: |
242+
suffix=-rockchip,onlatest=true
243+
latest=auto
244+
tags: |
245+
type=ref,event=branch
246+
type=semver,pattern={{version}},enable=false
247+
type=match,pattern=v(.*),group=1
248+
249+
- name: Set up QEMU
250+
uses: docker/setup-qemu-action@v3
251+
252+
- name: Set up Docker Buildx
253+
uses: docker/setup-buildx-action@v3
254+
255+
- name: Login to DockerHub
256+
if: github.event_name != 'pull_request'
257+
uses: docker/login-action@v3
258+
with:
259+
username: ${{ secrets.DOCKERHUB_USERNAME }}
260+
password: ${{ secrets.DOCKERHUB_TOKEN }}
261+
262+
- name: Login to GitHub Container Registry
263+
if: github.event_name != 'pull_request'
264+
uses: docker/login-action@v3
265+
with:
266+
registry: ghcr.io
267+
username: ${{ github.actor }}
268+
password: ${{ secrets.GITHUB_TOKEN }}
269+
270+
- name: Build and push
271+
uses: docker/build-push-action@v5
272+
with:
273+
context: .
274+
file: docker/rockchip.Dockerfile
275+
platforms: linux/arm64
276+
push: ${{ github.event_name != 'pull_request' }}
277+
tags: ${{ steps.meta-rk.outputs.tags }}
278+
labels: ${{ steps.meta-rk.outputs.labels }}
279+
cache-from: type=gha
280+
cache-to: type=gha,mode=max

docker/rockchip.Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# syntax=docker/dockerfile:labs
2+
3+
# 0. Prepare images
4+
ARG PYTHON_VERSION="3.13-slim-bookworm"
5+
ARG GO_VERSION="1.24-bookworm"
6+
7+
8+
# 1. Build go2rtc binary
9+
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
10+
ARG TARGETPLATFORM
11+
ARG TARGETOS
12+
ARG TARGETARCH
13+
14+
ENV GOOS=${TARGETOS}
15+
ENV GOARCH=${TARGETARCH}
16+
17+
WORKDIR /build
18+
19+
# Cache dependencies
20+
COPY go.mod go.sum ./
21+
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
22+
23+
COPY . .
24+
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath
25+
26+
27+
# 2. Final image
28+
FROM python:${PYTHON_VERSION}
29+
30+
# Prepare apt for buildkit cache
31+
RUN rm -f /etc/apt/apt.conf.d/docker-clean \
32+
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache
33+
34+
# Install ffmpeg, tini (for signal handling),
35+
# and other common tools for the echo source.
36+
# libasound2-plugins for ALSA support
37+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked --mount=type=cache,target=/var/lib/apt,sharing=locked \
38+
apt-get -y update && apt-get -y install tini \
39+
curl jq \
40+
libasound2-plugins && \
41+
apt-get clean && rm -rf /var/lib/apt/lists/*
42+
43+
COPY --from=build /build/go2rtc /usr/local/bin/
44+
ADD --chmod=755 https://github.com/MarcA711/Rockchip-FFmpeg-Builds/releases/download/6.1-8-no_extra_dump/ffmpeg /usr/local/bin
45+
46+
ENTRYPOINT ["/usr/bin/tini", "--"]
47+
VOLUME /config
48+
WORKDIR /config
49+
50+
CMD ["go2rtc", "-config", "/config/go2rtc.yaml"]

0 commit comments

Comments
 (0)