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

docker: Build and run as a non-privileged user #6053

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
417 changes: 257 additions & 160 deletions Dockerfile

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions docker/android.sh

This file was deleted.

20 changes: 0 additions & 20 deletions docker/ort-wrapper.sh

This file was deleted.

27 changes: 0 additions & 27 deletions docker/python.sh

This file was deleted.

25 changes: 0 additions & 25 deletions docker/ruby.sh

This file was deleted.

26 changes: 0 additions & 26 deletions docker/rust.sh

This file was deleted.

20 changes: 9 additions & 11 deletions docker/00-add_local_path.sh → docker/set_apt_proxy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (C) 2021 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
# Copyright (C) 2020 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,13 +17,11 @@
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

# Global functions
add_local_path () {
case ":${PATH:=$1}:" in
*:"$1":*) ;;
*) PATH="$1:$PATH" ;;
esac;
if [ -n "$http_proxy" ]; then
cat << EOF > /etc/apt/apt.conf.d/proxy.conf
Acquire {
HTTP::proxy "$http_proxy";
HTTPS::proxy "$http_proxy";
}

export -f add_local_path

EOF
fi
5 changes: 3 additions & 2 deletions scripts/docker_build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
#
# Copyright (C) 2020 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
#
Expand All @@ -21,12 +21,13 @@ DOCKER_ARGS=$@

GIT_ROOT=$(git rev-parse --show-toplevel)
GIT_REVISION=$(git describe --abbrev=10 --always --tags --dirty --match=[0-9]*)
PLATFORM="${PLATFORM:-linux/$(arch)}"

echo "Setting ORT_VERSION to $GIT_REVISION."
docker buildx build \
-f "$GIT_ROOT/Dockerfile" \
-t "${ORT_DOCKER_TAG:-ort}" \
--build-arg ORT_VERSION="$GIT_REVISION" \
--platform linux/amd64 \
--platform "$PLATFORM" \
$DOCKER_ARGS \
"$GIT_ROOT"