-FROM golang:1.14
+FROM golang:1.21 AS builder
WORKDIR /app
COPY . .
-RUN go build -o /app/server/server /app/server/server.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
-EXPOSE 5500 5501 5502
+FROM debian:stable-slim
-WORKDIR /app/server/
-CMD ["server"]
\ No newline at end of file
+# 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
+
+USER ${USERNAME}
+ENTRYPOINT ["/app/server"]