<commit_before>#!/bin/bash
#
# See ./build for usage
#
# Must be absolute; see download/installers/container-run/radiasoft-download.sh
: ${build_docker_cmd:=/bin/bash}
: ${build_docker_entrypoint:=}
: ${build_is_public:=}
: ${build_docker_registry:=}
: ${build_image_add:='docker pull'}
: ${build_dockerfile_aux:=}
: ${build_docker_user:=}

build_docker_version_is_old=
if [[ $(docker --version | perl -n -e '/ (\d+\.\d+)/ && print $1') =~ ^1\.[0-9]$ ]]; then
    build_docker_version_is_old=1
fi

build_clean_container() {
    : nothing to do, because do not have container handle from build
}

build_image() {
    rm -f Dockerfile
    local cmd=
    if [[ $build_docker_cmd ]]; then
        cmd="CMD $build_docker_cmd"
    fi
    local entrypoint=
    if [[ $build_docker_entrypoint ]]; then
        entrypoint="ENTRYPOINT $build_docker_entrypoint"
    fi
    local user=
    if [[ $build_docker_user ]]; then
        user="USER $build_docker_user"
    fi
    local bi=$build_image_base
    if [[ $build_docker_registry ]]; then
        local x=$build_docker_registry/$bi
        if build_image_exists "$x"; then
            bi=$x
        fi
    fi
    cat > Dockerfile <<EOF
FROM $bi
MAINTAINER "$build_maintainer"
ADD . $build_guest_conf
RUN "$build_run"
$cmd
$entrypoint
# run user must be after build_run, because changes user during build
$user
$build_dockerfile_aux
EOF
    local flags=()
    #TODO(robnagler) Really want to check for
    #   IPv4 forwarding is disabled. Networking will not work.
    # However, this doesn't work on older versions, since it prints something
    # similar even when forwarding is disabled.
    if docker build --help 2>&1 | fgrep -q -s -- --network; then
        flags+=( --network=host )<commit_msg>need to USER<commit_after>#!/bin/bash
#
# See ./build for usage
#
# Must be absolute; see download/installers/container-run/radiasoft-download.sh
: ${build_docker_cmd:=/bin/bash}
: ${build_docker_entrypoint:=}
: ${build_is_public:=}
: ${build_docker_registry:=}
: ${build_image_add:='docker pull'}
: ${build_dockerfile_aux:=}
: ${build_docker_user:=}

build_docker_version_is_old=
if [[ $(docker --version | perl -n -e '/ (\d+\.\d+)/ && print $1') =~ ^1\.[0-9]$ ]]; then
    build_docker_version_is_old=1
fi

build_clean_container() {
    : nothing to do, because do not have container handle from build
}

build_image() {
    rm -f Dockerfile
    local cmd=
    if [[ $build_docker_cmd ]]; then
        cmd="CMD $build_docker_cmd"
    fi
    local entrypoint=
    if [[ $build_docker_entrypoint ]]; then
        entrypoint="ENTRYPOINT $build_docker_entrypoint"
    fi
    local bi=$build_image_base
    if [[ $build_docker_registry ]]; then
        local x=$build_docker_registry/$bi
        if build_image_exists "$x"; then
            bi=$x
        fi
    fi
    cat > Dockerfile <<EOF
FROM $bi
MAINTAINER "$build_maintainer"
USER root
ADD . $build_guest_conf
RUN "$build_run"
$cmd
$entrypoint
# run user must be after build_run, because changes user during build
USER ${build_docker_user:-$build_run_user}
$build_dockerfile_aux
EOF
    local flags=()
    #TODO(robnagler) Really want to check for
    #   IPv4 forwarding is disabled. Networking will not work.
    # However, this doesn't work on older versions, since it prints something
    # similar even when forwarding is disabled.
    if docker build --help 2>&1 | fgrep -q -s -- --network; then
        flags+=( --network=host )
{'fraction_non_alphanumeric': 0.12536443148688048, 'fraction_numerical': 0.004664723032069971, 'mean_word_length': 3.450064850843061, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1504627', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1124, 'n_words': 313}