From c6e9fc42026fe145cd8bc8f6535099cd65fe69ef Mon Sep 17 00:00:00 2001 From: Code-Otto <129909770+Code-Otto@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:38:43 +0200 Subject: [PATCH] Add Dockerfile Drops server to non-root privileges. Small container filesize Build with: docker build --pull -t emulatorjs-netplay:latest . Run with: docker run -d -p 4000:4000 emulatorjs-netplay --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5dd6f3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +#Build container +FROM alpine:latest AS build + +RUN apk add --no-cache cargo + +RUN mkdir /build +WORKDIR /build +COPY ./ /build + +RUN cargo build -r + + +#Runtime container +FROM alpine:latest + +RUN apk add --no-cache libgcc + +COPY --from=build --chmod=777 /build/target/release/rust-socket-server / + +RUN adduser -D -H netplayserver +USER netplayserver + +ENV PORT=4000 +EXPOSE 4000/tcp + +ENTRYPOINT [ "/rust-socket-server" ]