From aa8dc2f9b419e36d4d36afe46188d72374d1d980 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Tue, 21 Jan 2020 17:20:32 +0100 Subject: [PATCH] Add a Dockerfile, submitted by @Opvolger in #498. If I understand this right it only builds the dedicated server. I think that Dockerfiles need to be at the project root. Nevertheless I put it under stuff/, the root dir is already cluttered enough. Closes #498. --- stuff/misc/Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 stuff/misc/Dockerfile diff --git a/stuff/misc/Dockerfile b/stuff/misc/Dockerfile new file mode 100644 index 00000000..cafca4f9 --- /dev/null +++ b/stuff/misc/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:18.04 AS build + +WORKDIR /yquake2 +RUN apt-get update +RUN apt-get install libcurl4-openssl-dev build-essential -y +COPY . . + +RUN make server game + +FROM ubuntu:18.04 AS runtime + +ENV server_cfg="server.cfg" + +EXPOSE 27910 + +# Add the user UID:1000, GID:1000, home at /yquake2 +RUN groupadd -r yquake2 -g 1000 && useradd -u 1000 -r -g yquake2 -m -d /yquake2 -s /sbin/nologin -c "yquake2 user" yquake2 && \ + chmod 755 /yquake2 + +WORKDIR /yquake2 +COPY --from=build /yquake2/release ./ + +# Specify the user to execute all commands below +USER yquake2 + +RUN mkdir .yq2 +VOLUME ["/yquake2/.yq2"] +ENTRYPOINT ./q2ded +exec ${server_cfg}