diff --git a/Dockerfile b/Dockerfile index b3888820..7e235631 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,13 +3,18 @@ # 0. Prepare images ARG PYTHON_VERSION="3.11" 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 ARG TARGETPLATFORM 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 -# 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 -FROM base +FROM python:${PYTHON_VERSION}-alpine AS base # Install ffmpeg, tini (for signal handling), # 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) # 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", "--"] VOLUME /config