From 8e63de2103a14392c1ffab576a43a392941f7d37 Mon Sep 17 00:00:00 2001 From: Ukang'a Dickson Date: Fri, 17 May 2024 17:55:57 +0300 Subject: [PATCH] Use appuser from base image Supervisor and other apps are installed have this hard coded in the executable file --- docker/onadata-uwsgi/Dockerfile.ubuntu | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docker/onadata-uwsgi/Dockerfile.ubuntu b/docker/onadata-uwsgi/Dockerfile.ubuntu index a51b765200..0d6abd6e15 100644 --- a/docker/onadata-uwsgi/Dockerfile.ubuntu +++ b/docker/onadata-uwsgi/Dockerfile.ubuntu @@ -12,10 +12,10 @@ ENV DJANGO_SETTINGS_MODULE onadata.settings.docker USER root -RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts - -RUN mkdir -p /srv/onadata \ - && chown -R appuser:appuser /srv/onadata +RUN mkdir -p /root/.ssh && \ + ssh-keyscan github.com >> /root/.ssh/known_hosts && \ + mkdir -p /srv/onadata && \ + chown -R appuser:appuser /srv/onadata COPY ../../ /srv/onadata/ @@ -69,7 +69,7 @@ ENV LC_CTYPE en_US.UTF-8 RUN dpkg-reconfigure locales -# # Install OnaData Dependencies +# Install OnaData runtime dependencies RUN apt-get install -y --no-install-recommends \ gdal-bin \ git-core \ @@ -81,20 +81,20 @@ RUN apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # Create OnaData user and add to tty group -RUN useradd -G tty -m onadata \ - && mkdir -p /srv/onadata \ - && chown -R onadata:onadata /srv/onadata +RUN useradd -G tty -m appuser && \ + mkdir -p /srv/onadata && \ + chown -R appuser:appuser /srv/onadata -COPY --from=base /home/appuser/.pyenv/ /home/onadata/.pyenv/ +COPY --from=base /home/appuser/.pyenv/ /home/appuser/.pyenv/ COPY --from=docs /srv/onadata/ /srv/onadata/ COPY --from=base /usr/local/lib/ /usr/lib/ -RUN chown -R onadata:onadata /srv/onadata /home/onadata/.pyenv +RUN chown -R appuser:appuser /srv/onadata /home/appuser/.pyenv -USER onadata +USER appuser WORKDIR /srv/onadata -ENV HOME /home/onadata +ENV HOME /home/appuser ENV PYTHON_VERSION 3.10.14 ENV PYENV_ROOT="$HOME/.pyenv" ENV PATH $PYENV_ROOT/versions/3.10.14/bin:$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH