# Multi-stage build for the WebRTC signaling server. # Stage 1: compile signal.c statically against musl so the runtime image # doesn't need libc at all. FROM docker.io/library/alpine:3.20 AS build RUN apk add --no-cache gcc musl-dev WORKDIR /src COPY server/signal.c ./ RUN cc -O3 -Wall -Wextra -Werror -static signal.c -o signal # Stage 2: minimal runtime. Keep alpine (instead of scratch) so the # entrypoint can use /bin/sh + cp to publish index.html into the bind- # mounted /static directory on startup. FROM docker.io/library/alpine:3.20 RUN apk add --no-cache curl COPY --from=build /src/signal /usr/local/bin/signal COPY index.html /opt/static/index.html COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh EXPOSE 8080 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]