Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1491: adapt to rootless user #27

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions realtime/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@ ENV PYTHONFAULTHANDLER=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONHASHSEED=random
ENV PYTHONDONTWRITEBYTECODE=1
ENV HOME="/root"
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
ENV HOME="/home/realtime"
ENV PYENV_ROOT="$HOME/.pyenv"
ENV PATH="$PYENV_ROOT/shims:$PATH"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# base dependency install
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -q -y --no-install-recommends curl wget jq gnupg gnupg2 ca-certificates git build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev rclone

# install python and poetry with pyenv
RUN git clone https://github.com/pyenv/pyenv.git /pyenv && \
/pyenv/bin/pyenv install $PYTHON_VERSION && \
eval "$(/pyenv/bin/pyenv init -)" && /pyenv/bin/pyenv local $PYTHON_VERSION && pip install numpy poetry setuptools wheel six auditwheel && \
pip install poetry==$POETRY_VERSION

# install google-chrome
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
Expand All @@ -49,4 +43,14 @@ RUN wget -c -O KTX.deb https://github.com/KhronosGroup/KTX-Software/releases/dow
dpkg -i KTX.deb && \
rm KTX.deb

# creat realtime user
RUN groupadd --gid 10000 realtime && useradd --uid 10000 --gid 10000 --shell /bin/bash --create-home realtime

# install python and poetry with pyenv
USER realtime
RUN git clone https://github.com/pyenv/pyenv.git $HOME/pyenv && \
$HOME/pyenv/bin/pyenv install $PYTHON_VERSION && \
eval "$($HOME/pyenv/bin/pyenv init -)" && $HOME/pyenv/bin/pyenv global $PYTHON_VERSION && pip install numpy poetry setuptools wheel six auditwheel && \
pip install poetry==$POETRY_VERSION

CMD ["tail", "-f", "/dev/null"]