mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Support include offline data on clair startup
This commit is contained in:
parent
73c44723f5
commit
a23c6ee8c6
7
make/common/templates/clair/postgresql-init.d/README.md
Normal file
7
make/common/templates/clair/postgresql-init.d/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
This folder used to run some initial sql for clair if needed.
|
||||
|
||||
Just put the sql file in this directory and then start the
|
||||
clair .
|
||||
|
||||
both .sql and .gz format supported
|
||||
|
@ -24,6 +24,7 @@ services:
|
||||
env_file:
|
||||
./common/config/clair/postgres_env
|
||||
volumes:
|
||||
- ./common/config/clair/postgresql-init.d/:/docker-entrypoint-initdb.d
|
||||
- /data/clair-db:/var/lib/postgresql/data
|
||||
logging:
|
||||
driver: "syslog"
|
||||
|
@ -373,6 +373,10 @@ if args.clair_mode:
|
||||
pg_password = "password"
|
||||
clair_temp_dir = os.path.join(templates_dir, "clair")
|
||||
clair_config_dir = prep_conf_dir(config_dir, "clair")
|
||||
print("Copying offline data file for clair DB")
|
||||
if os.path.exists(os.path.join(clair_config_dir, "postgresql-init.d")):
|
||||
shutil.rmtree(os.path.join(clair_config_dir, "postgresql-init.d"))
|
||||
shutil.copytree(os.path.join(clair_temp_dir, "postgresql-init.d"), os.path.join(clair_config_dir, "postgresql-init.d"))
|
||||
postgres_env = os.path.join(clair_config_dir, "postgres_env")
|
||||
render(os.path.join(clair_temp_dir, "postgres_env"), postgres_env, password = pg_password)
|
||||
clair_conf = os.path.join(clair_config_dir, "config.yaml")
|
||||
|
Loading…
Reference in New Issue
Block a user