Add support arm/v6 to Dockerfile
This commit is contained in:
+13
-14
@@ -3,13 +3,18 @@
|
|||||||
# 0. Prepare images
|
# 0. Prepare images
|
||||||
ARG PYTHON_VERSION="3.11"
|
ARG PYTHON_VERSION="3.11"
|
||||||
ARG GO_VERSION="1.22"
|
ARG GO_VERSION="1.22"
|
||||||
ARG NGROK_VERSION="3"
|
|
||||||
|
|
||||||
FROM python:${PYTHON_VERSION}-alpine AS base
|
|
||||||
FROM ngrok/ngrok:${NGROK_VERSION}-alpine AS ngrok
|
|
||||||
|
|
||||||
|
|
||||||
# 1. Build go2rtc binary
|
# 1. Download ngrok binary (for support arm/v6)
|
||||||
|
FROM alpine AS ngrok
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG TARGETOS
|
||||||
|
|
||||||
|
ADD https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-${TARGETOS}-${TARGETARCH}.tgz /
|
||||||
|
RUN tar -xzf /ngrok-v3-stable-${TARGETOS}-${TARGETARCH}.tgz -C /bin
|
||||||
|
|
||||||
|
|
||||||
|
# 2. Build go2rtc binary
|
||||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS build
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS build
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
@@ -30,15 +35,8 @@ COPY . .
|
|||||||
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath
|
RUN --mount=type=cache,target=/root/.cache/go-build 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/
|
|
||||||
|
|
||||||
|
|
||||||
# 3. Final image
|
# 3. Final image
|
||||||
FROM base
|
FROM python:${PYTHON_VERSION}-alpine AS base
|
||||||
|
|
||||||
# Install ffmpeg, tini (for signal handling),
|
# Install ffmpeg, tini (for signal handling),
|
||||||
# and other common tools for the echo source.
|
# and other common tools for the echo source.
|
||||||
@@ -56,7 +54,8 @@ RUN if [ "${TARGETARCH}" = "amd64" ]; then apk add --no-cache libva-intel-driver
|
|||||||
# Hardware: AMD and NVidia VDPAU (not sure about this)
|
# Hardware: AMD and NVidia VDPAU (not sure about this)
|
||||||
# RUN libva-vdpau-driver mesa-vdpau-gallium (+150MB total)
|
# RUN libva-vdpau-driver mesa-vdpau-gallium (+150MB total)
|
||||||
|
|
||||||
COPY --from=rootfs / /
|
COPY --from=build /build/go2rtc /usr/local/bin/
|
||||||
|
COPY --from=ngrok /bin/ngrok /usr/local/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/sbin/tini", "--"]
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
|
|||||||
Reference in New Issue
Block a user