Change Docker user parameters

This commit is contained in:
Andrew Ying 2024-11-17 22:12:22 +00:00
parent 05ff1742cc
commit 6d8005f7a3
Signed by: andrew
SSH key fingerprint: SHA256:6goOJXI6ckOipdsJS6oj5gbQYaRmCe37r7bSBnyQLyE

View file

@ -1,15 +1,13 @@
ARG PYTHON_VERSION=3.12.0 ARG PYTHON_VERSION=3.12.0
ARG PYTHON_VERSION_SHORT=3.12 ARG PYTHON_VERSION_SHORT=3.12
FROM ubuntu:22.04 AS python_build FROM ubuntu:22.04 AS python
ARG PYTHON_VERSION ARG PYTHON_VERSION
ARG PYTHON_VERSION_SHORT ARG PYTHON_VERSION_SHORT
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root
RUN apt-get update -y \ RUN apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y \ && apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \ ca-certificates \
@ -71,7 +69,8 @@ RUN apt-get update -y \
tklib \ tklib \
vim vim
RUN adduser --home /home/runner --shell /bin/bash --disabled-password runner \ RUN groupadd --gid 1000 runner \
&& adduser --home /workspace --shell /bin/sh --uid 1000 --gid 1000 --disabled-password runner \
&& adduser runner sudo \ && adduser runner sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
@ -102,7 +101,7 @@ RUN set -x \
&& npm install --global yarn \ && npm install --global yarn \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash
COPY --from=python_build /root/build /tmp/build COPY --from=python /root/build /tmp/build
RUN set -x \ RUN set -x \
&& cd /tmp/build/Python-${PYTHON_VERSION} \ && cd /tmp/build/Python-${PYTHON_VERSION} \
&& make install \ && make install \
@ -123,5 +122,9 @@ RUN curl -sSL -O https://packages.microsoft.com/config/ubuntu/22.04/packages-mic
&& apt-get update -y \ && apt-get update -y \
&& apt-get install --no-install-recommends --no-install-suggests -y azcopy && apt-get install --no-install-recommends --no-install-suggests -y azcopy
RUN mkdir -p /opt/hostedtoolcache \
&& chown runner:runner /opt/hostedtoolcache \
&& chmod 0755 /opt/hostedtoolcache
USER runner USER runner
WORKDIR /home/runner WORKDIR /workspace