mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-16 07:15:13 +01:00
fcdab4d4af
This new prepare script now support offline packaging Signed-off-by: Qian Deng <dengq@vmware.com>
51 lines
1.9 KiB
Bash
Executable File
51 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# If compling source code this dir is harbor's make dir
|
|
# If install harbor via pacakge, this dir is harbor's root dir
|
|
harbor_prepare_path="$( cd "$(dirname "$0")" ; pwd -P )"
|
|
|
|
echo host make path is set to ${harbor_prepare_path}
|
|
data_path=$(grep '^[^#]*data_volume:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
log_path=$(grep '^[^#]*location:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
secretkey_path=$(grep '^[^#]*secretkey_path:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
ssl_cert_path=$(grep '^[^#]*ssl_cert:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
ssl_cert_key_path=$(grep '^[^#]*ssl_cert_key:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
registry_custom_ca_bundle=$(grep '^[^#]*registry_custom_ca_bundle:' ${harbor_prepare_path}/harbor.yml | awk '{print $NF}')
|
|
|
|
# Create a input dirs
|
|
mkdir -p ${harbor_prepare_path}/input
|
|
input_dir=${harbor_prepare_path}/input
|
|
mkdir -p $input_dir/nginx
|
|
mkdir -p $input_dir/keys
|
|
mkdir -p $input_dir/common
|
|
|
|
# Copy nginx config file to input dir
|
|
cp $ssl_cert_path $input_dir/nginx/server.crt
|
|
cp $ssl_cert_key_path $input_dir/nginx/server.key
|
|
|
|
# Copy secretkey to input dir
|
|
cp -r $secretkey_path $input_dir/keys
|
|
|
|
# Copy ca bundle to input dir
|
|
if [ -f $registry_custom_ca_bundle ]
|
|
then
|
|
cp -r $registry_custom_ca_bundle $input_dir/common/custom-ca-bundle.crt
|
|
fi
|
|
|
|
# Copy harbor.yml to input dir
|
|
cp ${harbor_prepare_path}/harbor.yml $input_dir/harbor.yml
|
|
|
|
# Create secret dir
|
|
secret_dir=${data_path}/secret
|
|
config_dir=$harbor_prepare_path/common/config
|
|
|
|
# Run prepare script
|
|
docker run -it --rm -v $input_dir:/input \
|
|
-v $harbor_prepare_path:/compose_location \
|
|
-v $config_dir:/config \
|
|
-v $secret_dir:/secret \
|
|
-v $log_path:/var/log/harbor \
|
|
goharbor/prepare:dev $@
|
|
|
|
# Clean up input dir
|
|
rm -rf ${harbor_prepare_path}/input |