From aa2b534624039f52a0407fd37b367b06e4fe6576 Mon Sep 17 00:00:00 2001 From: Angel Rey Date: Tue, 21 Jul 2020 11:16:29 -0500 Subject: [PATCH 1/4] Commented nginx --- docker-compose.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a64be92b..01c7558c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,17 +17,19 @@ services: command: server 0.0.0.0:8000 stdin_open: true tty: true + ports: + - 8000:8000 environment: - USE_COLOR=True - SHOW_PROGRESS=False volumes: - ./data:/data - nginx: - image: nginx:alpine - ports: - - 443:443 - - 80:80 - volumes: - - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf - - ./data:/var/www +# nginx: +# image: nginx:alpine +# ports: +# - 443:443 +# - 80:80 +# volumes: +# - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf +# - ./data:/var/www From f50b44d51c5e46aa5d82c69b0bbde0e1f41e45f3 Mon Sep 17 00:00:00 2001 From: Cristian Date: Tue, 21 Jul 2020 12:47:21 -0500 Subject: [PATCH 2/4] fix: Dont change GID nor UID when the owner of the volume is the root user --- bin/entrypoint.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 3cc2930d..40c41762 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -4,6 +4,7 @@ DATA_DIR="${DATA_DIR:-/data}" ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}" +echo $ARCHIVEBOX_USER # Autodetect UID and GID of host user based on ownership of files in the volume USID=$(stat --format="%u" "$DATA_DIR") GRID=$(stat --format="%g" "$DATA_DIR") @@ -13,7 +14,11 @@ COMMAND="$@" # e.g. ./manage.py runserver chown "$USID":"$GRID" "$DATA_DIR" -chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER" -usermod -u $USID $ARCHIVEBOX_USER -groupmod -g $GRID $ARCHIVEBOX_USER + +if [ $USID -ne 0 ] && [ $GRID -ne 0 ] +then + chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER" + usermod -u $USID $ARCHIVEBOX_USER + groupmod -g $GRID $ARCHIVEBOX_USER +fi gosu $ARCHIVEBOX_USER bash -c "$COMMAND" From 6e8e3c69fd4357976b37b24af9ee249e81b8f211 Mon Sep 17 00:00:00 2001 From: Cristian Date: Tue, 21 Jul 2020 13:29:07 -0500 Subject: [PATCH 3/4] fix: Remove unused echo --- bin/entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 40c41762..17e61186 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -4,7 +4,6 @@ DATA_DIR="${DATA_DIR:-/data}" ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}" -echo $ARCHIVEBOX_USER # Autodetect UID and GID of host user based on ownership of files in the volume USID=$(stat --format="%u" "$DATA_DIR") GRID=$(stat --format="%g" "$DATA_DIR") From fa771c95059baec29b59bd4a9d7a189f7961b13b Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 21 Jul 2020 16:14:54 -0400 Subject: [PATCH 4/4] Use modern bash 4.0+ conditional style --- bin/entrypoint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 17e61186..57b8cdb2 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -14,10 +14,9 @@ COMMAND="$@" chown "$USID":"$GRID" "$DATA_DIR" -if [ $USID -ne 0 ] && [ $GRID -ne 0 ] -then - chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER" - usermod -u $USID $ARCHIVEBOX_USER - groupmod -g $GRID $ARCHIVEBOX_USER +if [[ "$USID" != 0 && "$GRID" != 0 ]]; then + usermod -u $USID $ARCHIVEBOX_USER + groupmod -g $GRID $ARCHIVEBOX_USER + chown -R "$USID":"$GRID" "/home/$ARCHIVEBOX_USER" fi gosu $ARCHIVEBOX_USER bash -c "$COMMAND"