Skip to content

Commit

Permalink
Use appuser from base image
Browse files Browse the repository at this point in the history
Supervisor and other apps are installed have this hard coded in the executable file
  • Loading branch information
ukanga committed May 20, 2024
1 parent f7f531d commit 8e63de2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docker/onadata-uwsgi/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down

0 comments on commit 8e63de2

Please sign in to comment.