Some checks are pending
tests / build (push) Waiting to run
- Cleaned up comments and formatting in YAML library files (readerc.go, scannerc.go, writerc.go, yaml.go, yamlh.go, yamlprivateh.go). - Improved readability by aligning comments and removing unnecessary whitespace. - Added Dockerfile for ffmpeg-ndi dependencies, ensuring necessary libraries are installed. - Created Dockerfile for restreamer, integrating UI and core components with ffmpeg. - Introduced docker-compose.yml to manage services including avahi, ffmpeg-ndi, and core. - Implemented NDIHandler in the API to discover NDI sources using ffmpeg. - Added placeholder HTML for the Restreamer UI to prevent build issues. - Included Install_NDI_SDK_v6_Linux.sh script for NDI SDK installation.
67 lines
2.7 KiB
Docker
67 lines
2.7 KiB
Docker
ARG GOLANG_IMAGE=golang:1.22-alpine3.19
|
|
ARG FFMPEG_IMAGE=nextream/ffmpeg-ndi:v5.1
|
|
|
|
FROM --platform=$BUILDPLATFORM $GOLANG_IMAGE AS builder
|
|
|
|
RUN apk add git make
|
|
|
|
# Cache go module downloads separately from source code.
|
|
# This layer only rebuilds when go.mod/go.sum/vendor change.
|
|
WORKDIR /dist/core
|
|
COPY go.mod go.sum ./
|
|
COPY vendor/ ./vendor/
|
|
|
|
# Now copy source and build. This layer rebuilds on any .go file change.
|
|
# Do NOT include local configuration or secret files in the build context.
|
|
# Ensure your .dockerignore excludes config files (e.g. config.json, v1.json, .env).
|
|
COPY . .
|
|
# If you need build-time secrets, use BuildKit secrets and `RUN --mount=type=secret,...`.
|
|
RUN make release && make import && make ffmigrate
|
|
|
|
FROM $FFMPEG_IMAGE
|
|
|
|
COPY --from=builder /dist/core/core /core/bin/core
|
|
COPY --from=builder /dist/core/import /core/bin/import
|
|
COPY --from=builder /dist/core/ffmigrate /core/bin/ffmigrate
|
|
COPY --from=builder /dist/core/mime.types /core/mime.types
|
|
COPY --from=builder /dist/core/run.sh /core/bin/run.sh
|
|
|
|
# Optional NDI SDK installer copied into the image for runtime installation/testing.
|
|
# The installer may require additional packages or kernel headers and is left
|
|
# to be executed at runtime (e.g. docker cp ndi_sdk/ into a running container)
|
|
# or invoked by an operator when appropriate.
|
|
COPY ndi_sdk /tmp/ndi_sdk
|
|
# Add ffmpeg wrapper to normalize version output for Core's parser
|
|
RUN printf '%s\n' '#!/bin/sh' 'if echo "$$@" | grep -q "-version"; then' ' # Print a normalized first line for Core and exit' ' ver=$(/usr/local/bin/ffmpeg -hide_banner -version 2>/dev/null | sed -n "1p" | sed "s/^[^0-9]*\([0-9]\+\.[0-9]\+\).*/\1/")' ' if [ -z "${ver}" ]; then ver="0.0"; fi' ' echo "ffmpeg version ${ver}"' ' exit 0' 'fi' 'exec /usr/local/bin/ffmpeg "$$@"' > /usr/local/bin/ffmpeg-core && chmod +x /usr/local/bin/ffmpeg-core || true
|
|
|
|
RUN chmod +x /core/bin/run.sh && mkdir -p /core/config /core/data
|
|
|
|
ENV CORE_CONFIGFILE=/core/config/config.json
|
|
ENV CORE_STORAGE_DISK_DIR=/core/data
|
|
ENV CORE_DB_DIR=/core/config
|
|
ENV CORE_WHIP_ENABLE=true
|
|
ENV CORE_WHIP_ADDRESS=:8555
|
|
ENV CORE_WHIP_RTSP_ADDRESS=:8554
|
|
# Security note: do not hardcode sensitive configuration or secrets in the image.
|
|
# Set runtime flags and secrets when launching the container instead, for example:
|
|
# docker run -e CORE_API_AUTH_ENABLE=false ...
|
|
# The following env is intentionally left unset in the image to avoid baking config:
|
|
ENV CORE_API_AUTH_ENABLE=false
|
|
ENV CORE_RTMP_ENABLE=true
|
|
ENV CORE_SRT_ENABLE=true
|
|
ENV CORE_PLAYOUT_ENABLE=true
|
|
ENV CORE_METRICS_ENABLE=true
|
|
ENV CORE_METRICS_ENABLE_PROMETHEUS=true
|
|
|
|
EXPOSE 8080/tcp
|
|
EXPOSE 8181/tcp
|
|
EXPOSE 1935/tcp
|
|
EXPOSE 1936/tcp
|
|
EXPOSE 6000/udp
|
|
EXPOSE 8555/tcp
|
|
EXPOSE 8554/tcp
|
|
|
|
VOLUME ["/core/data", "/core/config"]
|
|
ENTRYPOINT ["/core/bin/run.sh"]
|
|
WORKDIR /core
|