diff --git a/Dockerfile b/Dockerfile index e1f4b56..e6c083b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,20 @@ RUN --mount=type=cache,target=/go/pkg/mod \ go build -o screeps-launcher ./cmd/screeps-launcher FROM buildpack-deps:buster -RUN groupadd --gid 1000 screeps \ - && useradd --uid 1000 --gid screeps --shell /bin/bash --create-home screeps \ - && mkdir /screeps && chown screeps.screeps /screeps -USER screeps + +ARG UID=1000 +ARG GID=1000 +RUN <<-EOT bash + if [[ "${GID}" != "0" ]] ; then + groupadd --gid ${GID} screeps + fi + if [[ "${UID}" != "0" ]] ; then + useradd --uid ${UID} --gid ${GID} --shell /bin/bash --create-home screeps + fi + mkdir /screeps && chown ${UID}:${GID} /screeps +EOT + +USER ${UID}:${GID} VOLUME /screeps WORKDIR /screeps COPY --from=builder /app/screeps-launcher /usr/bin/ diff --git a/docker-compose.yml b/docker-compose.yml index 602fd72..9b14160 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ services: context: . args: ARCH: amd64 + UID: 1000 + GID: 1000 image: screepers/screeps-launcher volumes: - ./config.yml:/screeps/config.yml