mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
build(portal): npm registry configurable and build cache support (#9356)
1. Introduce NPM_REGISTRY in Makefile to support npm registry configuration when build portal image. 2. Install npm pkgs before copy portal src so that build cache works for npm install in portal image. Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
parent
a87ab69baa
commit
6fbb77d65a
4
Makefile
4
Makefile
@ -81,6 +81,7 @@ CLAIRFLAG=false
|
||||
HTTPPROXY=
|
||||
BUILDBIN=false
|
||||
MIGRATORFLAG=false
|
||||
NPM_REGISTRY=https://registry.npmjs.org
|
||||
# enable/disable chart repo supporting
|
||||
CHARTFLAG=false
|
||||
|
||||
@ -304,7 +305,8 @@ build:
|
||||
-e REGISTRYVERSION=$(REGISTRYVERSION) -e NGINXVERSION=$(NGINXVERSION) -e NOTARYVERSION=$(NOTARYVERSION) -e NOTARYMIGRATEVERSION=$(NOTARYMIGRATEVERSION) \
|
||||
-e CLAIRVERSION=$(CLAIRVERSION) -e CLAIRDBVERSION=$(CLAIRDBVERSION) -e VERSIONTAG=$(VERSIONTAG) \
|
||||
-e BUILDBIN=$(BUILDBIN) -e REDISVERSION=$(REDISVERSION) -e MIGRATORVERSION=$(MIGRATORVERSION) \
|
||||
-e CHARTMUSEUMVERSION=$(CHARTMUSEUMVERSION) -e DOCKERIMAGENAME_CHART_SERVER=$(DOCKERIMAGENAME_CHART_SERVER)
|
||||
-e CHARTMUSEUMVERSION=$(CHARTMUSEUMVERSION) -e DOCKERIMAGENAME_CHART_SERVER=$(DOCKERIMAGENAME_CHART_SERVER) \
|
||||
-e NPM_REGISTRY=$(NPM_REGISTRY)
|
||||
|
||||
install: compile ui_version build prepare start
|
||||
|
||||
|
@ -109,7 +109,7 @@ _build_db:
|
||||
|
||||
_build_portal:
|
||||
@echo "building portal container for photon..."
|
||||
$(DOCKERBUILD) -f $(DOCKERFILEPATH_PORTAL)/$(DOCKERFILENAME_PORTAL) -t $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) .
|
||||
$(DOCKERBUILD) --build-arg npm_registry=$(NPM_REGISTRY) -f $(DOCKERFILEPATH_PORTAL)/$(DOCKERFILENAME_PORTAL) -t $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) .
|
||||
@echo "Done."
|
||||
|
||||
_build_core:
|
||||
|
@ -1,18 +1,23 @@
|
||||
FROM node:10.15.0 as nodeportal
|
||||
|
||||
COPY src/portal /portal_src
|
||||
COPY ./docs/swagger.yaml /portal_src
|
||||
COPY ./LICENSE /portal_src
|
||||
|
||||
WORKDIR /build_dir
|
||||
|
||||
ARG npm_registry=https://registry.npmjs.org
|
||||
ENV NPM_CONFIG_REGISTRY=${npm_registry}
|
||||
|
||||
RUN cp -r /portal_src/* /build_dir \
|
||||
&& ls -la \
|
||||
&& apt-get update \
|
||||
COPY src/portal/package.json /build_dir
|
||||
COPY src/portal/package-lock.json /build_dir
|
||||
COPY ./docs/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 \
|
||||
&& npm install \
|
||||
&& npm install
|
||||
|
||||
COPY ./LICENSE /build_dir
|
||||
COPY src/portal /build_dir
|
||||
|
||||
RUN ls -la \
|
||||
&& npm run build_lib \
|
||||
&& npm run link_lib \
|
||||
&& node --max_old_space_size=8192 'node_modules/@angular/cli/bin/ng' build --prod
|
||||
|
Loading…
Reference in New Issue
Block a user