Merge branch 'seprate_harbor_portal_from_harbor_core' into angular6

This commit is contained in:
Qian Deng 2018-09-07 14:56:16 +08:00
commit db8d7b9c1c
503 changed files with 209 additions and 265 deletions

14
.gitignore vendored
View File

@ -24,11 +24,11 @@ src/ui/static/styles.css
src/ui/static/i18n src/ui/static/i18n
src/ui/static/shapes src/ui/static/shapes
src/ui_ng/coverage/ src/portal/coverage/
src/ui_ng/dist/ src/portal/dist/
src/ui_ng/html-report/ src/portal/html-report/
src/ui_ng/node_modules/ src/portal/node_modules/
src/ui_ng/typings/ src/portal/typings/
**/*npm-debug.log.* **/*npm-debug.log.*
**/*yarn-error.log.* **/*yarn-error.log.*
.idea/ .idea/
@ -39,8 +39,8 @@ src/ui_ng/typings/
**/ssl/ **/ssl/
**/proxy.config.json **/proxy.config.json
src/ui_ng/src/**/*.js src/portal/src/**/*.js
src/ui_ng/src/**/*.js.map src/portal/src/**/*.js.map
**/npm*.log **/npm*.log

View File

@ -71,7 +71,7 @@ before_script:
script: script:
- sudo make run_clarity_ut CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:${UI_BUILDER_VERSION} - sudo make run_clarity_ut CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:${UI_BUILDER_VERSION}
- cat ./src/ui_ng/npm-ut-test-results - cat ./src/portal/npm-ut-test-results
- sudo docker-compose -f ./make/docker-compose.test.yml up -d - sudo docker-compose -f ./make/docker-compose.test.yml up -d
- make go_check - make go_check
- ./tests/pushimage.sh - ./tests/pushimage.sh

View File

@ -93,7 +93,7 @@ The folder graph below shows the structure of the source code folder `harbor/src
│   ├── static │   ├── static
│   ├── utils │   ├── utils
│   └── views │   └── views
├── ui_ng # The code of harbor web UI ├── portal # The code of harbor web UI
│   ├── e2e │   ├── e2e
│   ├── lib # Source code of @harbor/ui npm library which includes the main UI components of web UI │   ├── lib # Source code of @harbor/ui npm library which includes the main UI components of web UI
│   └── src # General web page UI code of Harbor │   └── src # General web page UI code of Harbor
@ -134,11 +134,11 @@ Harbor web UI is built based on [Clarity](https://vmware.github.io/clarity/) and
**Npm Package Dependency:** Run the following commands to restore the package dependencies. **Npm Package Dependency:** Run the following commands to restore the package dependencies.
``` ```
#For the web UI #For the web UI
cd $REPO_DIR/src/ui_ng cd $REPO_DIR/src/portal
npm install npm install
#For the UI library #For the UI library
cd $REPO_DIR/src/ui_ng/lib cd $REPO_DIR/src/portal/lib
npm install npm install
``` ```
@ -213,7 +213,7 @@ go test -v ./...
Run UI library test cases: Run UI library test cases:
``` ```
#cd #working_dir/src/ui_ng/lib #cd #working_dir/src/portal/lib
npm run test npm run test
``` ```

View File

@ -68,7 +68,7 @@ MAKEDEVPATH=$(MAKEPATH)/dev
SRCPATH=./src SRCPATH=./src
TOOLSPATH=$(BUILDPATH)/tools TOOLSPATH=$(BUILDPATH)/tools
UIPATH=$(BUILDPATH)/src/ui UIPATH=$(BUILDPATH)/src/ui
UINGPATH=$(BUILDPATH)/src/ui_ng UINGPATH=$(BUILDPATH)/src/portal
GOBASEPATH=/go/src/github.com/goharbor GOBASEPATH=/go/src/github.com/goharbor
CHECKENVCMD=checkenv.sh CHECKENVCMD=checkenv.sh
@ -110,7 +110,7 @@ CHARTMUSEUMVERSION=v0.7.1
#clarity parameters #clarity parameters
CLARITYIMAGE=goharbor/harbor-clarity-ui-builder[:tag] CLARITYIMAGE=goharbor/harbor-clarity-ui-builder[:tag]
CLARITYSEEDPATH=/harbor_src CLARITYSEEDPATH=/harbor_src
CLARITYUTPATH=${CLARITYSEEDPATH}/ui_ng/lib CLARITYUTPATH=${CLARITYSEEDPATH}/portal/lib
CLARITYBUILDSCRIPT=/entrypoint.sh CLARITYBUILDSCRIPT=/entrypoint.sh
# docker parameters # docker parameters
@ -183,6 +183,7 @@ DOCKERFILE_CLARITY=$(MAKEPATH)/dev/nodeclarity/Dockerfile
# docker image name # docker image name
DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
DOCKERIMAGENAME_UI=goharbor/harbor-ui DOCKERIMAGENAME_UI=goharbor/harbor-ui
DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice
DOCKERIMAGENAME_LOG=goharbor/harbor-log DOCKERIMAGENAME_LOG=goharbor/harbor-log
@ -218,6 +219,7 @@ REGISTRYPASSWORD=default
# cmds # cmds
DOCKERSAVE_PARA=$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \ DOCKERSAVE_PARA=$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \ $(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \ $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \ $(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
@ -304,7 +306,7 @@ compile_registryctl:
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_REGISTRYCTL) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_REGISTRYCTL)/$(REGISTRYCTLBINARYNAME) @$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_REGISTRYCTL) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_REGISTRYCTL)/$(REGISTRYCTLBINARYNAME)
@echo "Done." @echo "Done."
compile:check_environment compile_clarity compile_adminserver compile_ui compile_jobservice compile_registryctl compile:check_environment compile_adminserver compile_ui compile_jobservice compile_registryctl
prepare: prepare:
@echo "preparing..." @echo "preparing..."
@ -444,6 +446,11 @@ pushimage:
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER) $(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) @$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG)
@$(DOCKERTAG) $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
@$(DOCKERTAG) $(DOCKERIMAGENAME_UI):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) @$(DOCKERTAG) $(DOCKERIMAGENAME_UI):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \ @$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER) $(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)

View File

@ -1,6 +1,6 @@
# Customize the look & feel of Harbor # Customize the look & feel of Harbor
The primary look & feel of Harbor supports to be customized with several simple steps. All the relevant customization in configurations are saved in the `setting.json` file under `$HARBOR_DIR/src/ui_ng/src` folder with `json` format and will be loaded when Harbor is launched. The primary look & feel of Harbor supports to be customized with several simple steps. All the relevant customization in configurations are saved in the `setting.json` file under `$HARBOR_DIR/src/portal/src` folder with `json` format and will be loaded when Harbor is launched.
## Configure ## Configure
Open the `setting.json` file, you'll see the default content as shown below: Open the `setting.json` file, you'll see the default content as shown below:

View File

@ -4,7 +4,7 @@
### Steps to localize the UI in your language ### Steps to localize the UI in your language
1. In the folder `src/ui_ng/src/i18n/lang`, copy json file `en-us-lang.json` to a new file and rename it to `<language>-<locale>-lang.json` . 1. In the folder `src/portal/src/i18n/lang`, copy json file `en-us-lang.json` to a new file and rename it to `<language>-<locale>-lang.json` .
The file contains a JSON object including all the key-value pairs of UI strings: The file contains a JSON object including all the key-value pairs of UI strings:
``` ```
@ -21,7 +21,7 @@
2. After creating your language file, you should add it to the language supporting list. 2. After creating your language file, you should add it to the language supporting list.
Locate the file `src/ui_ng/src/app/shared/shared.const.ts`. Locate the file `src/portal/src/app/shared/shared.const.ts`.
Append `<language>-<locale>` to the language supporting list: Append `<language>-<locale>` to the language supporting list:
``` ```
export const supportedLangs = ['en-us', 'zh-cn', '<language>-<locale>']; export const supportedLangs = ['en-us', 'zh-cn', '<language>-<locale>'];
@ -39,7 +39,7 @@
3. Enable the new language in the view. 3. Enable the new language in the view.
Locate the file `src/ui_ng/src/app/base/navigator/navigator.component.html` and then find the following code piece: Locate the file `src/portal/src/app/base/navigator/navigator.component.html` and then find the following code piece:
``` ```
<div class="dropdown-menu"> <div class="dropdown-menu">
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("en-us")' [class.lang-selected]='matchLang("en-us")'>English</a> <a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("en-us")' [class.lang-selected]='matchLang("en-us")'>English</a>

View File

@ -16,6 +16,10 @@ http {
server ui:8080; server ui:8080;
} }
upstream portal {
server portal:80;
}
log_format timed_combined '$$remote_addr - ' log_format timed_combined '$$remote_addr - '
'"$$request" $$status $$body_bytes_sent ' '"$$request" $$status $$body_bytes_sent '
'"$$http_referer" "$$http_user_agent" ' '"$$http_referer" "$$http_user_agent" '
@ -30,11 +34,37 @@ http {
client_max_body_size 0; client_max_body_size 0;
location / { location / {
proxy_pass http://portal/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /api/ {
proxy_pass http://ui/api/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location ~ ^/(login|log_out|sendEmail|language|reset|userExists|reset_password|chartrepo) {
proxy_pass http://ui/; proxy_pass http://ui/;
proxy_set_header Host $$host; proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme; proxy_set_header X-Forwarded-Proto $$scheme;
@ -51,7 +81,7 @@ http {
proxy_set_header Host $$http_host; proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme; proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off; proxy_buffering off;
@ -63,15 +93,15 @@ http {
proxy_set_header Host $$host; proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings. # When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme; proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off; proxy_buffering off;
proxy_request_buffering off; proxy_request_buffering off;
} }
location /service/notifications { location /service/notifications {
return 404; return 404;
} }
} }

View File

@ -16,6 +16,10 @@ http {
upstream ui { upstream ui {
server ui:8080; server ui:8080;
} }
upstream portal {
server portal:80;
}
log_format timed_combined '$$remote_addr - ' log_format timed_combined '$$remote_addr - '
'"$$request" $$status $$body_bytes_sent ' '"$$request" $$status $$body_bytes_sent '
@ -47,7 +51,7 @@ http {
chunked_transfer_encoding on; chunked_transfer_encoding on;
location / { location / {
proxy_pass http://ui/; proxy_pass http://portal/;
proxy_set_header Host $$http_host; proxy_set_header Host $$http_host;
proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
@ -61,6 +65,32 @@ http {
proxy_buffering off; proxy_buffering off;
proxy_request_buffering off; proxy_request_buffering off;
} }
location /api/ {
proxy_pass http://ui/api/;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location ~ ^/(login|log_out|sendEmail|language|reset|userExists|reset_password|chartrepo) {
proxy_pass http://ui;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
# When setting up Harbor behind other proxy, such as an Nginx instance, remove the below line if the proxy already has similar settings.
proxy_set_header X-Forwarded-Proto $$scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location /v1/ { location /v1/ {
return 404; return 404;

View File

@ -3,7 +3,7 @@ FROM node:10.7.0
RUN mkdir -p /harbor_resources RUN mkdir -p /harbor_resources
RUN mkdir -p /harbor_src RUN mkdir -p /harbor_src
COPY src/ui_ng/package.json /harbor_resources COPY src/portal/package.json /harbor_resources
COPY make/dev/nodeclarity/entrypoint.sh / COPY make/dev/nodeclarity/entrypoint.sh /
# Install Chrome # Install Chrome

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e set -e
cd /harbor_src/ui_ng cd /harbor_src/portal
rm -rf dist/* rm -rf dist/*
npm_proxy= npm_proxy=
@ -27,12 +27,12 @@ cat ./package.json
npm install npm install
## Build harbor-ui and link it ## Build harbor-ui and link it
rm -rf /harbor_src/ui_ng/lib/dist rm -rf /harbor_src/portal/lib/dist
npm run build:lib npm run build:lib
chmod -R +xr /harbor_src/ui_ng/lib/dist chmod -R +xr /harbor_src/portal/lib/dist
cd /harbor_src/ui_ng/lib/dist cd /harbor_src/portal/lib/dist
npm link npm link
cd /harbor_src/ui_ng cd /harbor_src/portal
npm link harbor-ui npm link harbor-ui
## Rollup ## Rollup

View File

@ -110,6 +110,18 @@ services:
options: options:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "ui" tag: "ui"
portal:
image: goharbor/harbor-portal:__version__
container_name: harbor-portal
restart: always
networks:
- harbor
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "portal"
jobservice: jobservice:
image: goharbor/harbor-jobservice:__version__ image: goharbor/harbor-jobservice:__version__
container_name: harbor-jobservice container_name: harbor-jobservice
@ -146,7 +158,7 @@ services:
syslog-address: "tcp://127.0.0.1:1514" syslog-address: "tcp://127.0.0.1:1514"
tag: "redis" tag: "redis"
proxy: proxy:
image: goharbor/nginx-photon:__nginx_version__ image: goharbor/nginx-photon:__version__
container_name: nginx container_name: nginx
restart: always restart: always
volumes: volumes:
@ -161,6 +173,7 @@ services:
- postgresql - postgresql
- registry - registry
- ui - ui
- portal
- log - log
logging: logging:
driver: "syslog" driver: "syslog"

View File

@ -39,6 +39,10 @@ DOCKERFILEPATH_ADMINSERVER=$(DOCKERFILEPATH)/adminserver
DOCKERFILENAME_ADMINSERVER=Dockerfile DOCKERFILENAME_ADMINSERVER=Dockerfile
DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver
DOCKERFILEPATH_PORTAL=$(DOCKERFILEPATH)/portal
DOCKERFILENAME_PORTAL=Dockerfile
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
DOCKERFILEPATH_UI=$(DOCKERFILEPATH)/ui DOCKERFILEPATH_UI=$(DOCKERFILEPATH)/ui
DOCKERFILENAME_UI=Dockerfile DOCKERFILENAME_UI=Dockerfile
DOCKERIMAGENAME_UI=goharbor/harbor-ui DOCKERIMAGENAME_UI=goharbor/harbor-ui
@ -106,6 +110,11 @@ _build_adminserver:
@$(DOCKERBUILD) -f $(DOCKERFILEPATH_ADMINSERVER)/$(DOCKERFILENAME_ADMINSERVER) -t $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) . @$(DOCKERBUILD) -f $(DOCKERFILEPATH_ADMINSERVER)/$(DOCKERFILENAME_ADMINSERVER) -t $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) .
@echo "Done." @echo "Done."
_build_portal:
@echo "building portal container for photon..."
$(DOCKERBUILD) -f $(DOCKERFILEPATH_PORTAL)/$(DOCKERFILENAME_PORTAL) -t $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) .
@echo "Done."
_build_ui: _build_ui:
@echo "building ui container for photon..." @echo "building ui container for photon..."
@$(DOCKERBUILD) -f $(DOCKERFILEPATH_UI)/$(DOCKERFILENAME_UI) -t $(DOCKERIMAGENAME_UI):$(VERSIONTAG) . @$(DOCKERBUILD) -f $(DOCKERFILEPATH_UI)/$(DOCKERFILENAME_UI) -t $(DOCKERIMAGENAME_UI):$(VERSIONTAG) .
@ -203,11 +212,12 @@ define _get_binary
$(WGET) --timeout 30 --no-check-certificate $1 -O $2 $(WGET) --timeout 30 --no-check-certificate $1 -O $2
endef endef
build: _build_db _build_adminserver _build_ui _build_jobservice _build_log _build_nginx _build_registry _build_registryctl _build_notary _build_clair _build_redis _build_chart_server build: _build_db _build_adminiserver _build_portal _build_ui _build_jobservice _build_log _build_nginx _build_registry _build_registryctl _build_notary _build_clair _build_redis _build_migrator _build_chart_server
cleanimage: cleanimage:
@echo "cleaning image for photon..." @echo "cleaning image for photon..."
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)

View File

@ -0,0 +1,35 @@
FROM node:10.7.0
RUN mkdir -p /portal_src
RUN mkdir -p /build_dir
COPY make/photon/portal/entrypoint.sh /
COPY src/portal /portal_src
WORKDIR /portal_src
RUN npm install && \
chmod u+x /entrypoint.sh
RUN /entrypoint.sh
VOLUME ["/portal_src"]
FROM photon:1.0
RUN tdnf distro-sync -y \
&& tdnf install -y nginx >> /dev/null \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& tdnf clean all
EXPOSE 80
VOLUME /var/cache/nginx /var/log/nginx /run
COPY --from=0 /build_dir/dist /usr/share/nginx/html
COPY make/photon/portal/nginx.conf /etc/nginx/nginx.conf
STOPSIGNAL SIGQUIT
HEALTHCHECK CMD curl --fail -s http://127.0.0.1 || exit 1
CMD ["nginx", "-g", "daemon off;"]

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
cd /build_dir
cp -r /portal_src/* .
ls -la
cat ./package.json
npm install
## Build harbor-ui and link it
rm -rf /build_dir/lib/dist
npm run build:lib
chmod -R +xr /build_dir/lib/dist
cd /build_dir/lib/dist
npm link
cd /build_dir
npm link harbor-ui
## Build production
npm run build:prod
## Unlink
npm unlink harbor-ui

View File

@ -0,0 +1,26 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html;
}
}
}

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Some files were not shown because too many files have changed in this diff Show More