datarhei-dragonfork-core/deploy/docker/Dockerfile

35 lines
932 B
Text
Raw Normal View History

# Dockerfile for the Dragon Fork WebRTC PoC (M1).
#
# Two-stage:
# 1. builder: compile a static linux/amd64 binary inside the repo
# 2. runtime: minimal scratch image with the binary only
#
# The PoC has no outbound HTTPS needs and no dynamic libraries, so
# `scratch` is safe. Image size ~14 MB.
#
# The binary's flags (-stream, -rtp-port, -listen, -public-ip) are
# passed via `command:` in docker-compose (or `docker run ...`).
# ---- builder ----
FROM golang:1.24-alpine AS builder
WORKDIR /src
COPY . .
# Static, stripped, no CGO — no shared libs needed in runtime stage.
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
RUN go build -trimpath -ldflags="-s -w" \
-o /out/webrtc-poc \
./cmd/webrtc-poc
# ---- runtime ----
FROM scratch AS runtime
COPY --from=builder /out/webrtc-poc /webrtc-poc
# Defaults — override via `command:` or `docker run ...`.
EXPOSE 8787/tcp
EXPOSE 10000/udp
ENTRYPOINT ["/webrtc-poc"]