Browse Source

fix: docker-fron with nginx daemon

ryanemax 8 months ago
parent
commit
5e1a137cdc
4 changed files with 5 additions and 156 deletions
  1. 1 1
      docker-front
  2. 2 35
      docker/Dockerfile
  3. 2 1
      docker/README.md
  4. 0 119
      server/config/nginx-server.conf

+ 1 - 1
docker-front

@@ -1 +1 @@
-Subproject commit de4a08368a5ad2ea77b6a6abab2ba5c5cba269ea
+Subproject commit c6edfa4c6e50ff5f078de4c9cbe976bd233d3462

+ 2 - 35
docker/Dockerfile

@@ -61,45 +61,12 @@ RUN ls /opt/ && chown -R root:root /opt/*
 
 
 ######################################## PM2 && server node_modules
-RUN npm config set registry https://registry.npmmirror.com/ && npm i -g npm@10.8.1 && npm i -g pm2@^5.0.0 
+RUN npm config set registry https://registry.npmmirror.com/ && npm i -g npm@10.8.1
 RUN cd /opt/edu-textbook-server/ && npm i --omit dev  --no-warn
-# RUN npm i -g bytenode@1.3.6
-
-######################################## Deploy Latest Nova Cloud
-RUN cd /opt/edu-textbook-server && pm2 start server.js \
-    && sleep 5s \
-    && pm2 startup && pm2 save \
-
-######################################## Verify All Depands is OK
-
-    && node --version \
-    && pm2 ls \
-    && node --version \
-    && npm --version 
-
-######################################## Clean All Resources
-# RUN apt-mark auto '.*' > /dev/null \
-#     && find /usr/local -type f -executable -exec ldd '{}' ';' \
-#       | awk '/=>/ { print $(NF-1) }' \
-#       | sort -u \
-#       | xargs -r dpkg-query --search \
-#       | cut -d: -f1 \
-#       | sort -u \
-#       | xargs -r apt-mark manual \
-#     && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
-#     && rm -rf /var/log/* \
-#     && env
-    # && rm -r /var/log/postgresql/* \
-    # && rm -r /var/log/apt/* \
-    # && rm -r /var/log/nginx/* \
-
-
-# COPY docker-entrypoint.sh /usr/local/bin/
 
 # DEFAULT WEB
 EXPOSE 80
-EXPOSE 61337
 # DEFAULT SSL
 EXPOSE 443
 
-ENTRYPOINT [ "node","/opt/edu-textbook-server/keepalive.js" ]
+ENTRYPOINT [ "node","/opt/edu-textbook-server/server.js" ]

+ 2 - 1
docker/README.md

@@ -36,4 +36,5 @@ sudo docker save fmode:edu-textbook-1.0.0 -o ../dist/fmode-edu-textbook-1.0.0.ta
 # 工作流(阿里云镜像构建部署)
 - 后端WebHook
     - http://flow-openapi.aliyun.com/scm/webhook/536ptuKD686Wn6vEqVIz
-        - https://gitee.com/hep10/tbook-backend.git
+        - https://gitee.com/hep10/tbook-backend.git
+        - 临时地址 http://145.tbook.com.cn/api

+ 0 - 119
server/config/nginx-server.conf

@@ -1,122 +1,3 @@
-# server {
-
-#     server_name _;
-#     server_tokens off;
-
-#     #large_client_header_buffers 4 32k;
-#     client_max_body_size 50M;
-
-#     charset utf-8;
-
-#     index index.html;
-
-
-#     # 启动SSL及证书匹配 ######################################################
-#     listen 443 ssl default_server; # managed by Certbot
-    
-#     # ssl_certificate /etc/letsencrypt/live/edutextbook/fullchain.pem; # managed by Certbot
-#     # ssl_certificate_key /etc/letsencrypt/live/edutextbook/privkey.pem; # managed by Certbot
-
-#     # include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
-#     # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
-
-# 	# 启用OCSP stapling ######################################################
-# 	ssl_stapling on;
-# 	ssl_stapling_verify on;
-# 	# valid表示缓存5分钟
-# 	resolver 8.8.8.8 8.8.4.4 valid=300s;
-# 	# 网络超时时间
-# 	resolver_timeout 5s;
-
-# 	# 启动Gzip Json模式 ######################################################
-# 	gzip_http_version 1.0;  # gzip支持http协议 proxy 必须用
-#     gzip  on;
-# 	gzip_vary on;
-# 	gzip_proxied       any;
-# 	gzip_static on;
-# 	gzip_comp_level  4;
-# 	gzip_min_length 256;
-#     gzip_buffers     4 8k;
-#     gzip_types       text/html text/plain application/javascript application/x-javascript text/css application/xml application/json;
-
-#     location /api {
-#         if ($request_method = 'OPTIONS') {
-#             add_header 'Access-Control-Allow-Origin' '*';
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-#             #
-#             # Custom headers and headers various browsers *should* be OK with but aren't
-#             #
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
-#             #
-#             # Tell client that this pre-flight info is valid for 20 days
-#             #
-#             add_header 'Access-Control-Max-Age' 1728000;
-#             add_header 'Content-Type' 'text/plain; charset=utf-8';
-#             add_header 'Content-Length' 0;
-#             return 204;
-#         }
-#         if ($request_method = 'POST') {
-#             add_header 'Access-Control-Allow-Origin' '*' always;
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
-#             add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
-#         }
-#         if ($request_method = 'GET') {
-#             add_header 'Access-Control-Allow-Origin' '*' always;
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
-#             add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
-#         }
-
-#         rewrite ^/(.*)$ /$1 break;
-#         proxy_pass http://127.0.0.1:61337/api;
-#     }
-
-#     location /parse {
-#         if ($request_method = 'OPTIONS') {
-#             add_header 'Access-Control-Allow-Origin' '*';
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
-#             #
-#             # Custom headers and headers various browsers *should* be OK with but aren't
-#             #
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
-#             #
-#             # Tell client that this pre-flight info is valid for 20 days
-#             #
-#             add_header 'Access-Control-Max-Age' 1728000;
-#             add_header 'Content-Type' 'text/plain; charset=utf-8';
-#             add_header 'Content-Length' 0;
-#             return 204;
-#         }
-#         if ($request_method = 'POST') {
-#             add_header 'Access-Control-Allow-Origin' '*' always;
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
-#             add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
-#         }
-#         if ($request_method = 'GET') {
-#             add_header 'Access-Control-Allow-Origin' '*' always;
-#             add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
-#             add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
-#             add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
-#         }
-
-#         rewrite ^/(.*)$ /$1 break;
-#         proxy_pass http://127.0.0.1:61337/parse;
-#     }
-
-#     location /{
-#         proxy_set_header Host $http_host;
-#         proxy_set_header X-Real-IP $remote_addr;
-#         proxy_set_header X-Scheme $scheme;
-#         proxy_set_header X-Forwarded-Proto $scheme;
-#         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-#         proxy_pass http://127.0.0.1:61337/;
-#         proxy_redirect off;
-#     }
-
-# }
-
 
 server {
     listen 80 default_server;