48 lines
2.4 KiB
Docker
48 lines
2.4 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Linux amd64: Steam Audio's official x64 SDK requires glibc.
|
|
ARG GO_IMAGE=golang:1.26.7-bookworm@sha256:e8c859f5632dcfde7b32d2012b4351728f6437930887c2f6a91ea242459e5514
|
|
ARG RUNTIME_IMAGE=debian:bookworm-slim@sha256:3783cc01769c7b2b1b83a5c5ad96c815348e28ed7da68e2e3687004faa906251
|
|
FROM ${GO_IMAGE} AS builder
|
|
ARG TARGETARCH
|
|
RUN test "$TARGETARCH" = amd64
|
|
WORKDIR /src
|
|
ENV GOTOOLCHAIN=local CGO_ENABLED=0
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|
COPY cmd/ cmd/
|
|
COPY pkg/ pkg/
|
|
COPY version/ version/
|
|
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
|
|
go build -trimpath -o /out/livekit-server ./cmd/server && \
|
|
go build -trimpath -o /out/spatial-node ./cmd/spatial-node
|
|
|
|
FROM ${RUNTIME_IMAGE} AS hrtf-builder
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl unzip cmake g++ make \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /sdk
|
|
RUN curl --fail --location --retry 3 --output steam.zip \
|
|
https://github.com/ValveSoftware/steam-audio/releases/download/v4.8.1/steamaudio_4.8.1.zip \
|
|
&& echo '4a0aa5ec1176f38f0b0993a37c2259d9e86f27e22d5e24f83ec4c3cb9a1d5449 steam.zip' | sha256sum -c - \
|
|
&& unzip -q steam.zip && rm steam.zip
|
|
COPY native/hrtf/ /bridge/
|
|
RUN cmake -S /bridge -B /build -DCMAKE_BUILD_TYPE=Release -DSTEAMAUDIO_ROOT=/sdk/steamaudio \
|
|
&& cmake --build /build --parallel 2
|
|
|
|
FROM ${RUNTIME_IMAGE} AS runtime
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libopus0 libstdc++6 libgcc-s1 libgomp1 \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& groupadd --gid 10001 spatial && useradd --uid 10001 --gid spatial --no-create-home spatial \
|
|
&& mkdir -p /run/spatial && chown spatial:spatial /run/spatial
|
|
COPY --from=builder /out/ /usr/local/bin/
|
|
COPY --from=hrtf-builder /build/libsverse_hrtf.so /build/libphonon.so /opt/sverse/hrtf/
|
|
COPY --from=hrtf-builder /sdk/steamaudio/THIRDPARTY.md /usr/share/licenses/steam-audio/THIRDPARTY.md
|
|
COPY docs/third-party/steam-audio-LICENSE.md /usr/share/licenses/steam-audio/LICENSE.md
|
|
COPY LICENSE /usr/share/licenses/livekit/LICENSE
|
|
ENV LD_LIBRARY_PATH=/opt/sverse/hrtf
|
|
USER 10001:10001
|
|
STOPSIGNAL SIGTERM
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=60s --retries=3 \
|
|
CMD ["/usr/local/bin/spatial-node", "health"]
|
|
ENTRYPOINT ["/usr/local/bin/spatial-node"]
|
|
CMD ["run"]
|