From 1a8d823a17b7f004997346e2dcdb82a7e9a76150 Mon Sep 17 00:00:00 2001 From: vrifox Date: Tue, 2 May 2023 14:51:13 +0200 Subject: [PATCH 1/4] add userid variable Add a variable for the userid and use 1000 as default. --- Dockerfile | 3 ++- docker-compose.yml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index db39d8f..bbbb41b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,8 @@ RUN chmod +x docker-entrypoint.sh RUN mkdir -p /home/srm/tmp #COPY Gemfile.lock /home/srm/tmp/Gemfile.lock -RUN groupadd -r srm && useradd -r -g srm srm +ARG USER_ID=1000 +RUN groupadd srm && useradd -D --uid $USER_ID -g srm srm RUN chown -R srm:srm /home/srm USER srm diff --git a/docker-compose.yml b/docker-compose.yml index 175b6b2..062fd5d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,10 @@ version: "3.7" services: web: user: srm - build: . + build: + context: . + args: + - USER_ID=1000 volumes: - .:/app ports: From c1ac6a2325a4c4ec3af9770c8942567152439607 Mon Sep 17 00:00:00 2001 From: vrifox Date: Tue, 2 May 2023 19:42:40 +0200 Subject: [PATCH 2/4] remove incorrect -D option --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bbbb41b..9d709a4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN mkdir -p /home/srm/tmp #COPY Gemfile.lock /home/srm/tmp/Gemfile.lock ARG USER_ID=1000 -RUN groupadd srm && useradd -D --uid $USER_ID -g srm srm +RUN groupadd srm && useradd --uid $USER_ID -g srm srm RUN chown -R srm:srm /home/srm USER srm From 8e92e18f79cc870418c74199efcecd0660ecce27 Mon Sep 17 00:00:00 2001 From: vrifox Date: Tue, 2 May 2023 19:52:28 +0200 Subject: [PATCH 3/4] add .env variable USER_ID To harmonize the configuration I added the possibility to change the USER_ID variable in the .env file. Furthermore I appended the example variable, incl. a explanatory comment, to the .env.sample. --- .env.sample | 1 + docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index c741e89..d26efeb 100644 --- a/.env.sample +++ b/.env.sample @@ -1,2 +1,3 @@ +USER_ID=1000 # Set if your user id is different (`id -u`) APPLICATION_HOST=localhost ESDATA=../esdata \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 062fd5d..397f725 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: context: . args: - - USER_ID=1000 + - USER_ID=${USER_ID=1000} volumes: - .:/app ports: From db4338ff95014af6b98e96717f155331f824f2ee Mon Sep 17 00:00:00 2001 From: vrifox Date: Tue, 2 May 2023 20:08:57 +0200 Subject: [PATCH 4/4] fix variable syntax --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 397f725..f6eb89b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: context: . args: - - USER_ID=${USER_ID=1000} + - USER_ID=${USER_ID:-1000} volumes: - .:/app ports: