安装

Mac推荐手动下载,brew太慢了太慢了!
centos安装

常用命令

docker pull
docker images
docker ps -a
docker run —name nginx -p 8080:80 -d nginx
docker exec -it nginx /bin/bash
exit
将主机/www/runoob目录拷贝到容器96f7f14e99ab的/www目录下。
docker cp /www/runoob 96f7f14e99ab:/www/
将主机/www/runoob目录拷贝到容器96f7f14e99ab中,目录重命名为www。
docker cp /www/runoob 96f7f14e99ab:/www

/etc/nginx/conf.d
/usr/share/nginx/html

打包发布

  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name localhost;
  5. #charset koi8-r;
  6. #access_log /var/log/nginx/host.access.log main;
  7. #location /qingdao {
  8. # proxy_pass: http://dtp-demo-web-qindao:8991/;
  9. #}
  10. location / {
  11. root /usr/share/nginx/html;
  12. index index.html index.htm;
  13. try_files $uri $uri/ /index.html;
  14. }
  15. #error_page 404 /404.html;
  16. # redirect server error pages to the static page /50x.html
  17. #
  18. error_page 500 502 503 504 /50x.html;
  19. location = /50x.html {
  20. root /usr/share/nginx/html;
  21. }
  22. location /api/ {
  23. proxy_pass http://dt-co-server.hdt.cosmoplat.com;
  24. }
  25. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  26. #
  27. #location ~ \.php$ {
  28. # proxy_pass http://127.0.0.1;
  29. #}
  30. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  31. #
  32. #location ~ \.php$ {
  33. # root html;
  34. # fastcgi_pass 127.0.0.1:9000;
  35. # fastcgi_index index.php;
  36. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  37. # include fastcgi_params;
  38. #}
  39. # deny access to .htaccess files, if Apache's document root
  40. # concurs with nginx's one
  41. #
  42. #location ~ /\.ht {
  43. # deny all;
  44. #}
  45. }
  1. FROM nginx
  2. COPY dist /usr/share/nginx/html
  3. COPY default.conf /etc/nginx/conf.d/default.conf
  4. EXPOSE 80
  1. echo "获取最新代码"
  2. git pull
  3. echo "打包"
  4. npm run build
  5. echo "替换dist"
  6. rm -rf docker/dist
  7. cp -r dist docker/dist
  8. # 发布
  9. cd docker
  10. echo "docker打包镜像"
  11. docker build -t registry2-qingdao.cosmoplat.com/skcc/dt-co-web:$1 .
  12. docker images
  13. echo "docker登录"
  14. # docker login -u <用户ID> -p <access_key> registry2-qingdao.cosmoplat.com
  15. echo "docker推送"
  16. docker push registry2-qingdao.cosmoplat.com/skcc/dt-co-web:$1