周玉环 hace 2 semanas
padre
commit
b858aee21b
Se han modificado 6 ficheros con 10 adiciones y 5 borrados
  1. 1 1
      Dockerfile
  2. 1 1
      client/vue.config.js
  3. 1 1
      docker-compose.yml
  4. 1 1
      server/index.js
  5. 3 1
      server/package.json
  6. 3 0
      server/script-browser.js

+ 1 - 1
Dockerfile

@@ -29,7 +29,7 @@ RUN cp -r client/dist/* server/public/
 WORKDIR /app/server
 
 # 暴露端口
-EXPOSE 3000
+EXPOSE 9001
 
 # 启动服务
 CMD ["node", "index.js"]

+ 1 - 1
client/vue.config.js

@@ -6,7 +6,7 @@ module.exports = {
   devServer: {
     proxy: {
       '/api': {
-        target: 'http://localhost:3000', // 后端接口地址(开发阶段)
+        target: 'http://localhost:9001', // 后端接口地址(开发阶段)
         changeOrigin: true,
         // pathRewrite: { '^/api': '/api' },
       },

+ 1 - 1
docker-compose.yml

@@ -2,6 +2,6 @@ services:
   web:
     build: .
     ports:
-      - "3000:3000"
+      - "9001:9001"
     volumes:
       - ./server/screenshots:/app/server/screenshots

+ 1 - 1
server/index.js

@@ -4,7 +4,7 @@ const { spawn } = require('child_process');
 const cors = require('cors');
 
 const app = express();
-const PORT = process.env.NODE_ENV === 'development' ? 8080 : 3000;
+const PORT = process.env.NODE_ENV === 'development' ? 8080 : 9001;
 const SCREENSHOTS_DIR = path.join(__dirname, 'screenshots');
 const CLIENT_DIST_DIR = process.env.NODE_ENV === 'development' ? path.join(__dirname, '../client/dist') : path.join(__dirname, './public');
 

+ 3 - 1
server/package.json

@@ -3,7 +3,9 @@
   "version": "1.0.0",
   "scripts": {
     "start": "node index.js",
-    "dev": "NODE_ENV=development nodemon index.js"
+    "build-client": "cd ../client && npm run build",
+    "serve": "NODE_ENV=development nodemon index.js",
+    "dev": "npm run build-client && npm run serve"
   },
   "dependencies": {
     "cors": "^2.8.5",

+ 3 - 0
server/script-browser.js

@@ -9,6 +9,9 @@ export const options = {
       options: {
         browser: {
           type: 'chromium',
+          launchOptions: {
+            args: ['--no-sandbox', '--disable-setuid-sandbox']
+          }
         }
       },
     },