nextcloud-spreed-signaling/docker/proxy/Dockerfile
Leo bb996a7571
dockerfile: create system user (uid <= 999) instead of normal user (uid >= 1000), avoid home directory
currently the signaling server is run as uid=1000, which may be the occupied by
the first non-root normal user on most unix setups, despite not causing permission
or privilege issues, (uid is just an icon in docker, privileges are determined by linux
CAPs) a user whose uid=1000 could terminate the process of signaling server running in docker

this patch ensures that user `spreedbackend` in the container has a uid <= 999 by specifying
`adduser -S` to address the issue mentioned above

this patch also prevent creating of home directory, which is not necessary,
for user `spreedbackend` with `adduser -H`

Signed-off-by: Leo <i@hardrain980.com>
2025-08-21 19:12:19 +08:00

26 lines
714 B
Docker

FROM --platform=${BUILDPLATFORM} golang:1.25-alpine AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workdir
COPY . .
RUN touch /.dockerenv && \
apk add --no-cache bash git make && \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} make proxy
FROM alpine:3
ENV CONFIG=/config/proxy.conf
RUN adduser -D -S -H spreedbackend && \
apk add --no-cache bash tzdata ca-certificates su-exec
COPY --from=builder /workdir/bin/proxy /usr/bin/nextcloud-spreed-signaling-proxy
COPY ./proxy.conf.in /config/proxy.conf.in
COPY ./docker/proxy/entrypoint.sh /
COPY ./docker/proxy/stop.sh /
COPY ./docker/proxy/wait.sh /
RUN /usr/bin/nextcloud-spreed-signaling-proxy -version
STOPSIGNAL SIGUSR1
ENTRYPOINT [ "/entrypoint.sh" ]