Add docker image with Hardware drivers
This commit is contained in:
@@ -22,9 +22,18 @@ jobs:
|
|||||||
images: alexxit/go2rtc
|
images: alexxit/go2rtc
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
|
- name: Docker meta Hardware
|
||||||
|
id: meta-hw
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: alexxit/go2rtc
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch,suffix=-hardware
|
||||||
|
type=semver,pattern={{version}}-hardware,latest=false
|
||||||
|
type=semver,pattern=hardware,latest=false
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
@@ -50,3 +59,13 @@ jobs:
|
|||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Build and push Hardware
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile.hardware
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta-hw.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta-hw.outputs.labels }}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# 0. Prepare images
|
||||||
|
# only debian 12 (bookworm) has latest ffmpeg
|
||||||
|
ARG DEBIAN_VERSION="bookworm-slim"
|
||||||
|
ARG GO_VERSION="1.19-buster"
|
||||||
|
ARG NGROK_VERSION="3"
|
||||||
|
|
||||||
|
FROM debian:${DEBIAN_VERSION} AS base
|
||||||
|
FROM golang:${GO_VERSION} AS go
|
||||||
|
FROM ngrok/ngrok:${NGROK_VERSION} AS ngrok
|
||||||
|
|
||||||
|
|
||||||
|
# 1. Build go2rtc binary
|
||||||
|
FROM go AS build
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# Cache dependencies
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath
|
||||||
|
|
||||||
|
|
||||||
|
# 2. Collect all files
|
||||||
|
FROM scratch AS rootfs
|
||||||
|
|
||||||
|
COPY --from=build /build/go2rtc /usr/local/bin/
|
||||||
|
COPY --from=ngrok /bin/ngrok /usr/local/bin/
|
||||||
|
COPY ./build/docker/run.sh /
|
||||||
|
|
||||||
|
|
||||||
|
# 3. Final image
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
# Install ffmpeg, bash (for run.sh), tini (for signal handling),
|
||||||
|
# and other common tools for the echo source.
|
||||||
|
# non-free for Intel QSV support (not used by go2rtc, just for tests)
|
||||||
|
RUN echo 'deb http://deb.debian.org/debian bookworm non-free' > /etc/apt/sources.list.d/debian-non-free.list && \
|
||||||
|
apt-get -y update && apt-get -y install tini ffmpeg python3 curl jq intel-media-va-driver-non-free
|
||||||
|
|
||||||
|
COPY --from=rootfs / /
|
||||||
|
|
||||||
|
RUN chmod a+x /run.sh && mkdir -p /config
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
|
|
||||||
|
# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
|
||||||
|
ENV NVIDIA_VISIBLE_DEVICES all
|
||||||
|
ENV NVIDIA_DRIVER_CAPABILITIES compute,video,utility
|
||||||
|
|
||||||
|
CMD ["/run.sh"]
|
||||||
Reference in New Issue
Block a user