Some checks failed
tests / build (push) Failing after 3s
Adds a dedicated deploy bundle under deploy/truenas/core/ so the real root Core binary — with the M2 WebRTC subsystem wired in — can replace the M1 webrtc-poc stack on the TrueNAS host. - Dockerfile: two-stage build on golang:1.24-alpine3.20 + alpine:3.20 runtime. FFmpeg is bundled so restream processes have their subprocess path ready. Copies the core binary from core/core (Go places the output file inside the core/ package directory because it can't overwrite a directory with a file) plus import and ffmigrate from the repo root. - docker-compose.yml: host-networked Core service, env-driven config (CORE_ADDRESS, CORE_API_AUTH_*, CORE_WEBRTC_ENABLE, CORE_WEBRTC_PUBLIC_IP), with config/ and data/ bind mounts. - README.md: M1→M2 cutover notes, one-time setup, JWT smoke test against /api/v3/whep/:id, and teardown. Verified: make release + make import + make ffmigrate all cross-compile cleanly for linux/amd64; go build ./... and go test ./... pass on the branch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
60 lines
2 KiB
Docker
60 lines
2 KiB
Docker
# Dragon Fork datarhei Core image (M2 + WebRTC egress).
|
|
#
|
|
# Builds the real root Core binary — the one that replaces the M1 PoC
|
|
# in production. FFmpeg is baked in so restream processes can run the
|
|
# RTP output legs emitted by the WebRTC subsystem.
|
|
#
|
|
# Two-stage:
|
|
# 1. builder: compile a static Go binary (CGO off — no dynamic libs)
|
|
# 2. runtime: alpine with ffmpeg for the subprocess path
|
|
#
|
|
# Usage via compose:
|
|
# docker compose -f deploy/truenas/core/docker-compose.yml up -d --build
|
|
#
|
|
# The compose file drives configuration via CORE_* env vars — see
|
|
# README.md in this directory.
|
|
|
|
# ---- builder ----
|
|
# go.mod requires go 1.24; pinning the image keeps Docker's toolchain
|
|
# download off the hot path and makes the build reproducible.
|
|
FROM golang:1.24-alpine3.20 AS builder
|
|
|
|
WORKDIR /src
|
|
RUN apk add --no-cache git make
|
|
|
|
COPY . .
|
|
|
|
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
|
RUN make release && make import && make ffmigrate
|
|
|
|
# ---- runtime ----
|
|
# Alpine with ffmpeg (Core shells out to it for every restream process).
|
|
# Scratch isn't an option here because the process manager needs ffmpeg
|
|
# on PATH.
|
|
FROM alpine:3.20 AS runtime
|
|
|
|
RUN apk add --no-cache ffmpeg tini ca-certificates
|
|
|
|
# make release's `-o core` lands the binary inside the core/ Go
|
|
# package directory (Go cannot overwrite a directory with a file, so
|
|
# it places the output file _inside_ it). The `import` and `ffmigrate`
|
|
# Makefile targets cd into app/<name> and write the binary back up to
|
|
# the repo root with a relative path, so those end up at /src/import
|
|
# and /src/ffmigrate.
|
|
COPY --from=builder /src/core/core /core/bin/core
|
|
COPY --from=builder /src/import /core/bin/import
|
|
COPY --from=builder /src/ffmigrate /core/bin/ffmigrate
|
|
COPY --from=builder /src/mime.types /core/mime.types
|
|
COPY --from=builder /src/run.sh /core/bin/run.sh
|
|
|
|
RUN 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
|
|
|
|
VOLUME ["/core/data", "/core/config"]
|
|
EXPOSE 8080/tcp
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "/core/bin/run.sh"]
|
|
WORKDIR /core
|