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