-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[CI] [GHA] Use non-root user in Dockerfiles #28903
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
Open
akashchi
wants to merge
148
commits into
openvinotoolkit:master
Choose a base branch
from
akashchi:ci/gha/non-root-dockerfiles
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+456
−31
Open
Changes from all commits
Commits
Show all changes
148 commits
Select commit
Hold shift + click to select a range
c8e7c65
use non-root user
akashchi 18a65ce
use non-root user
akashchi bcb864e
update tag
akashchi 9ad579e
use id
akashchi 546ffe1
install node
akashchi 80e62c0
use another work dir
akashchi 437fd33
specify work dir for container
akashchi 1ff3b1f
spaces
akashchi 3c75c6b
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 96c1f1d
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi b6575d1
setup node
akashchi ac0acfe
create workdir
akashchi 9cf3b61
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 3c76ba8
test job
akashchi c0ee5ab
w/o Docker
akashchi bb97bd7
different folder
akashchi d66754d
check id
akashchi fcd3a04
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 7be7716
use 1000 as user
akashchi 8240c43
rm workdir
akashchi fb79989
check id
akashchi cd45078
check with openvino
akashchi ee9e02f
combine commands
akashchi 8e3c6ed
merge
akashchi d97545c
add rw
akashchi 8efd601
check mount
akashchi 2290259
merge
akashchi ff35ed8
try a non-root user with the test job
akashchi f32b7b0
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi b3afd93
use in samples
akashchi dcccc90
enable U22
akashchi 6deb1e2
fix input for cxx job
akashchi 6347b1e
mv clang installation to Docker
akashchi 23ce9d3
merge
akashchi dc4e256
rm
akashchi f2a3f9c
use user-owned dir
akashchi 8775b4d
mv package install from job to Docker
akashchi efc5875
add another missing lib
akashchi 7375589
add missing packages, rm from the job
akashchi bdffab6
add non-root to U24
akashchi 393fdea
merge
akashchi 3bd6531
fix input for cxx job, rm dubplicate
akashchi a9d16d5
fix username
akashchi 762ddc3
use group ID
akashchi dedf8d0
add to test image
akashchi 2c570e4
add clang for samples
akashchi f7eea87
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 754f976
use non-root user in Android x64
akashchi 29e0502
merge
akashchi 9e3fef1
rm unused venv chown
akashchi 85997e0
rm unneded chown
akashchi 47aea0d
use non-root in Debian
akashchi b82ce45
fix input
akashchi 5e36d33
rm /venv chown from the test Debian Dockerfile
akashchi db5b4ef
enable fedora
akashchi e4d7055
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi b37a92d
add clang
akashchi d1c2ec3
only clang
akashchi 42d5c6e
use non-root in Linux arm
akashchi b05c35e
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi df64397
add packages
akashchi 325c214
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi a15e53d
use non-root for dpcpp
akashchi ca2b9c4
rm unused
akashchi 88f472e
update all setuptools
akashchi b6ce3c8
use non-root in build Dockerfiles
akashchi 960c138
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 03ce6c8
fix incorrect configurations
akashchi d23cd96
fix group id
akashchi 3aab437
setup buildx
akashchi b925a72
no volume cache
akashchi c67075d
check
akashchi ebe9074
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 90e6147
rootless docker
akashchi bd51003
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 2f0b3f5
try w/o config
akashchi caa78af
create dir
akashchi 52d52b0
use newer image
akashchi 2225e2f
build w/o docker
akashchi ec88f35
skip
akashchi 205add5
add dependencies, use the correct gcc
akashchi 17dd3e8
headers
akashchi be97a56
merge
akashchi 7f958d6
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 65e1a5d
specify linker
akashchi 46184bb
fix cmake option
akashchi 9032f47
install lld
akashchi b08b718
use cmake 3.26
akashchi d0d62d2
Update .github/workflows/manylinux_2014.yml
mryzhov 58d138a
merge
akashchi 79282f9
path w/o gcc-14
akashchi 7c19e82
Update .github/workflows/manylinux_2014.yml
mryzhov 5cc4c68
new LD_LIBRARY_PATH
akashchi 10c7dc5
merge
akashchi 59e707e
build py api outside docker
akashchi 74112e2
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 992a978
merge
akashchi 9cddfb2
skip storage
akashchi bf0e52d
comment out storage
akashchi 0809d02
skip
akashchi 425c582
add py3 to cmake
akashchi 69d6519
ad dvars to Py API biulding
akashchi c2791be
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi af0ba69
merge
akashchi e829879
do not build gcc10, use the default one
akashchi efbff7d
rm flags
akashchi aab226e
warning as error off
akashchi bb41e1e
merge
akashchi 864a16d
no dangling reference
akashchi 77f60ef
update pip
akashchi fc05aca
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 8222f75
use non-root in test dockerfiles
akashchi b555aa8
try w/o warning
akashchi cdffcaa
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi eeb7e97
use 3.10 as default
akashchi d1a50e0
set OV dev package dir
akashchi 084fcf5
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 3460f72
provide OV dir
akashchi ebb433f
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi a52394b
provide bin dir
akashchi 51598cb
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi b37850c
build Pythons as non-root
akashchi 2f83557
revert to root build for Python
akashchi 0037423
merge
akashchi a1a65d6
rm
akashchi 4c83239
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi d39081a
Merge branch 'master' into ci/gha/non-root-dockerfiles
akashchi 4d87092
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi a34e9df
use gha runner
akashchi 6bb6e66
Merge branch 'ci/gha/non-root-dockerfiles' of https://github.com/akas…
akashchi efc5c63
do not use py2
akashchi d980142
use non-root for manylinux
akashchi 6070750
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 8e482f2
use separate script
akashchi 5815c3f
revert
akashchi 312c6f4
merge
akashchi 95ef8e2
revert
akashchi 27128d6
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 4b690e2
uncomment artefact storing
akashchi 7e88baa
switch debian packages jobs to gh-hosted runners
akashchi c73fd02
Merge branch 'master' into ci/gha/non-root-dockerfiles
akashchi 6f87fb2
Merge branch 'master' into ci/gha/non-root-dockerfiles
akashchi 2b1fbaf
rm unused
akashchi ace95db
Merge branch 'master' into ci/gha/non-root-dockerfiles
akashchi faa4973
Merge remote-tracking branch 'upstream/master' into ci/gha/non-root-d…
akashchi 9eb8f47
rm unused
akashchi 73a5992
rm extra one
akashchi 5d56e3f
Merge branch 'master' into ci/gha/non-root-dockerfiles
akashchi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| pr-30691 | ||
| pr-28903 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| ARG REGISTRY="docker.io" | ||
| FROM ${REGISTRY}/library/ubuntu:20.04 | ||
|
|
||
| USER root | ||
| # Create a non-root user and group | ||
| ENV USER_NAME=runner | ||
| ENV USER_ID=1000 | ||
| ENV GROUP_NAME=${USER_NAME} | ||
| ENV GROUP_ID=${USER_ID} | ||
|
|
||
| RUN groupadd -g ${GROUP_ID} ${GROUP_NAME} | ||
| RUN useradd ${USER_NAME} -u ${USER_ID} -g ${GROUP_ID} -ms /bin/bash | ||
|
|
||
| # APT configuration | ||
| RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf && \ | ||
|
|
@@ -79,3 +86,22 @@ RUN python3.9 -m venv venv | |
| ENV PATH="/venv/bin:$SCCACHE_HOME:$PATH" | ||
|
|
||
| ENV PIP_CACHE_DIR=/mount/caches/pip/linux/${PIP_VERSION} | ||
|
|
||
| # Install Node | ||
| ENV NODE_VERSION=21.7.3 | ||
| ENV NVM_DIR=/.nvm | ||
| RUN mkdir -p $NVM_DIR | ||
| RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash | ||
| RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} | ||
| ENV PATH="$NVM_DIR/versions/node/v${NODE_VERSION}/bin/:${PATH}" | ||
|
|
||
| # Change ownership of the venv directory to the non-root user | ||
| RUN chown -R ${USER_NAME}:${USER_NAME} /venv | ||
|
||
|
|
||
| # Change ownership of node to the non-root user | ||
| RUN chown -R ${USER_NAME}:${USER_NAME} ${NVM_DIR} | ||
|
|
||
| # Switch to the non-root user | ||
| USER ${USER_NAME} | ||
|
akashchi marked this conversation as resolved.
|
||
|
|
||
| WORKDIR /home/${USER_NAME} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.