github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/pkg/cloud/dashboard/README.md (about) 1 # Build the dashboard 2 3 ``` 4 cargo install trunk wasm-bindgen-cli 5 rustup target add wasm32-unknown-unknown 6 trunk serve 7 ``` 8 9 ## init registry 10 11 ``` 12 docker run -p 5000:5000 -d --name registry registry:2.7.1 13 ``` 14 15 using nginx to proxy cors: 16 17 nginx.conf: 18 19 ``` 20 user nginx; 21 worker_processes 1; 22 23 error_log /var/log/nginx/error.log warn; 24 pid /var/run/nginx.pid; 25 26 events { 27 worker_connections 1024; 28 } 29 30 http { 31 include /etc/nginx/mime.types; 32 default_type application/octet-stream; 33 34 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 35 '$status $body_bytes_sent "$http_referer" ' 36 '"$http_user_agent" "$http_x_forwarded_for"'; 37 38 access_log /var/log/nginx/access.log main; 39 40 sendfile on; 41 #tcp_nopush on; 42 43 keepalive_timeout 65; 44 45 server { 46 listen 8000; #监听8000端口,可以改成其他端口 47 server_name localhost; # 当前服务的域名 48 49 location / { 50 if ($request_method = 'OPTIONS') { 51 add_header 'Access-Control-Allow-Origin' '*' always; 52 add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE' always; 53 add_header 'Access-Control-Allow-Headers' '*' always; 54 add_header 'Access-Control-Max-Age' 1728000 always; 55 add_header 'Content-Length' 0; 56 add_header 'Content-Type' 'text/plain; charset=utf-8'; 57 return 204; 58 } 59 60 if ($request_method ~* '(GET|POST|DELETE|PUT)') { 61 add_header 'Access-Control-Allow-Origin' '*' always; 62 } 63 proxy_pass http://172.17.0.3:5000; # the registry IP or domain name 64 proxy_http_version 1.1; 65 } 66 } 67 68 #gzip on; 69 70 include /etc/nginx/conf.d/*.conf; 71 } 72 ``` 73 74 ``` 75 docker run -d --name registry-proxy -p 8001:8000 \ 76 -v /Users/fanghaitao/nginx/nginx.conf:/etc/nginx/nginx.conf nginx:1.19.0 77 ``` 78 79 Then you can test the registry api: 80 81 ``` 82 curl http://localhost:8001/v2/_catalog 83 {"repositories":["centos","golang"]} 84 ```