]> git.r.bdr.sh - rbdr/mobius/blobdiff - Dockerfile
Fix bug that clears account password on permission edit
[rbdr/mobius] / Dockerfile
index 86cbd635931679f55d39591b7d3c35181c4985d7..75f324b04981e88feee2de51b5e54b169a844f29 100644 (file)
@@ -1,16 +1,22 @@
-FROM golang:1.18 AS builder
+FROM golang:1.22 AS builder
 
 WORKDIR /app
 COPY . .
 
-RUN CGO_ENABLED=0 go build -o /app/server/server cmd/mobius-hotline-server/main.go && chmod a+x /app/server/server
+RUN CGO_ENABLED=0 go build -o /app/server cmd/mobius-hotline-server/main.go && chmod a+x /app/server
 
-FROM scratch
+FROM debian:stable-slim
 
-WORKDIR /app/
-COPY --from=builder /app/server/server ./
-COPY --from=builder /app/cmd/mobius-hotline-server/mobius/config /usr/local/var/mobius/config
+# Change these as you see fit. This makes bind mounting easier so you don't have to edit bind mounted config files as root.
+ARG USERNAME=mobius
+ARG UID=1001
+ARG GUID=1001
 
+COPY --from=builder /app/server /app/server
+COPY --from=builder /app/cmd/mobius-hotline-server/mobius/config /usr/local/var/mobius/config
+RUN useradd -d /app -u ${UID} ${USERNAME}
+RUN chown -R ${USERNAME}:${USERNAME} /app
 EXPOSE 5500 5501
 
-CMD ["/app/server"]
+USER ${USERNAME}
+ENTRYPOINT ["/app/server"]