[Cherry-pick]Replace python script with node script for portal Dockerfile (#18641)

* Replace python script with node script for portal Dockerfile

Signed-off-by: AllForNothing <sshijun@vmware.com>

* Fix build db base error in build_base_images

Signed-off-by: Yang Jiao <jiaoya@vmware.com>

---------

Signed-off-by: AllForNothing <sshijun@vmware.com>
Signed-off-by: Yang Jiao <jiaoya@vmware.com>
Co-authored-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Shijun Sun 2023-05-08 20:06:46 +08:00 committed by GitHub
parent 3069231a2b
commit 1e616ad393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -8,6 +8,9 @@
* Add date here... Add signature here...
- Add your reason here...
* May 08 2023 <jiaoya@vmware.com>
- Refresh base image
* Feb 01 2023 <jiaoya@vmware.com>
- Refresh base image

View File

@ -348,6 +348,9 @@ build_base_docker:
build_base_images:
@echo build_base_images start
@for name in chartserver clair clair-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl; do \
if [ $$name == "db" ] ; then \
cd $(MAKEFILEPATH_PHOTON)/$$name && $(MAKEFILEPATH_PHOTON)/$$name/rpm_builder.sh && cd - ; \
fi; \
$(DOCKERBUILD) --pull -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t goharbor/harbor-$$name-base:$(BASEIMAGETAG) .; \
done
@echo build_base_images done

View File

@ -10,9 +10,8 @@ COPY src/portal/package.json /build_dir
COPY src/portal/package-lock.json /build_dir
COPY ./api/harbor/swagger.yaml /build_dir
RUN apt-get update \
&& apt-get install -y --no-install-recommends python-yaml=3.12-1 \
&& python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)' < swagger.yaml > swagger.json \
RUN npm install js-yaml@4.1.0 \
&& node -e "const yaml = require('js-yaml'); const fs = require('fs'); const swagger = yaml.load(fs.readFileSync('swagger.yaml', 'utf8')); fs.writeFileSync('swagger.json', JSON.stringify(swagger));" \
&& npm install
COPY ./LICENSE /build_dir