<commit_before>#!/bin/bash
#
#Script to build registry on Power
#
#Requires go compiler to be available in the PATH
#
# build_registry.sh

SRC="https://github.com/docker/distribution.git"
COMMIT_ID=ece8e132bf6585815fdd00990f6215122c58fb3f

CUR_DIR=`pwd`
INSTALL_DIR="${CUR_DIR}/go.bld"
BIN_DIR="${CUR_DIR}/go.bld/bin"
mkdir -p ${BIN_DIR}
GOPATH_BASE="${INSTALL_DIR}/src/github.com/docker"
mkdir -p ${GOPATH_BASE}
cd ${GOPATH_BASE}
git clone ${SRC} 
cd distribution
git checkout -q ${COMMIT_ID}
export GOPATH="${GOPATH_BASE}/distribution/Godeps/_workspace:${INSTALL_DIR}:${GOPATH}"
go build -o ${BIN_DIR}/registry ./cmd/registry

#To use the registry you need to copy the file cmd/registry/config-example.yml as config.yml and run it 
#./registry ./config.yml
<commit_msg>Add option for both dynamic and static build<commit_after>#!/bin/bash
#
#Script to build registry on Power
#
#Requires go compiler to be available in the PATH
#
# build_registry.sh

build_type=${1}
  
BUILD_TYPE=${build_type:-dynamic}

SRC="https://github.com/docker/distribution.git"
COMMIT_ID=ece8e132bf6585815fdd00990f6215122c58fb3f

#Install git

yum install -y git 

CUR_DIR=`pwd`
INSTALL_DIR="${CUR_DIR}/go.bld"
BIN_DIR="${CUR_DIR}/go.bld/bin"
mkdir -p ${BIN_DIR}
GOPATH_BASE="${INSTALL_DIR}/src/github.com/docker"
mkdir -p ${GOPATH_BASE}
cd ${GOPATH_BASE}
git clone ${SRC} 
cd distribution
git checkout -q ${COMMIT_ID}
export GOPATH="${GOPATH_BASE}/distribution/Godeps/_workspace:${INSTALL_DIR}:${GOPATH}"
if [ "${BUILD_TYPE}" == "static" ]
then
    BUILDFLAGS="-static -lnetgo"
else
    BUILDFLAGS=""
fi

go build -gccgoflags "${BUILDFLAGS}" -o ${BIN_DIR}/registry ./cmd/registry

#To use the registry you need to copy the file cmd/registry/config-example.yml as config.yml and run it 
#./registry ./config.yml
cp ./cmd/registry/config-example.yml ${BIN_DIR}/config.yml
{'fraction_non_alphanumeric': 0.14502164502164502, 'fraction_numerical': 0.02867965367965368, 'mean_word_length': 5.442508710801394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3900976', 'n_tokens_mistral': 741, 'n_tokens_neox': 665, 'n_words': 159}