From b928b2ff4411798008372020ff29c1ac8b0279fb Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 16 Nov 2024 00:06:38 +1100 Subject: [PATCH] use ARG ENV to chown /code for prod to allow gunicorn logs to work in prod as non-root user --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 16aad9c..00f6ba8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,15 @@ WORKDIR /code COPY . . # declare var +ARG ENV ARG BOOK_UID ARG BOOK_GID -WORKDIR /code RUN groupadd -g ${BOOK_GID} pybook && useradd -m -u ${BOOK_UID} -g ${BOOK_GID} pybook +# in prod, /code will be owned by root and gunicorn logs wont work, so chg to pybook +RUN if [ "$ENV" = "production" ]; then \ + chown -R pybook:pybook /code; \ + fi RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb RUN apt-get update && \