diff options
| author | Chris Jones <chris@sysengineerchris.com> | 2024-01-21 17:44:44 -0500 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2024-01-21 16:13:25 -0800 |
| commit | 5f81c5c8e4cae2d2aad0301a0fc6ad08ae0c417e (patch) | |
| tree | 009d75a41c2af158851c26aafa80ba2127a84f05 /Dockerfile | |
| parent | b4a15075b0c85d571e7427963ff784c1e9e5acd1 (diff) | |
Making it so mobius does not run as root in Docker.
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -5,12 +5,18 @@ COPY . . 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 + +# 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"] -CMD ["/app/server"] |