From 6d8005f7a3a13db16203c1032d7ec9751efb3a73 Mon Sep 17 00:00:00 2001 From: Andrew Ying Date: Sun, 17 Nov 2024 22:12:22 +0000 Subject: [PATCH] Change Docker user parameters --- ubuntu-jammy/Dockerfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ubuntu-jammy/Dockerfile b/ubuntu-jammy/Dockerfile index 3d33970..444b363 100644 --- a/ubuntu-jammy/Dockerfile +++ b/ubuntu-jammy/Dockerfile @@ -1,15 +1,13 @@ ARG PYTHON_VERSION=3.12.0 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_SHORT ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root - RUN apt-get update -y \ && apt-get install --no-install-recommends --no-install-suggests -y \ ca-certificates \ @@ -71,7 +69,8 @@ RUN apt-get update -y \ tklib \ 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 \ && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers @@ -102,7 +101,7 @@ RUN set -x \ && npm install --global yarn \ && 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 \ && cd /tmp/build/Python-${PYTHON_VERSION} \ && 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 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 -WORKDIR /home/runner +WORKDIR /workspace