File size: 877 Bytes
dc9e27a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Use Node.js 18 as the base image
FROM node:18-alpine

# Set the working directory
WORKDIR /app

# Copy package files first to leverage Docker cache
COPY frontend/React/package*.json ./

# Install dependencies
RUN npm install

# Copy source code after npm install to prevent unnecessary reinstalls
COPY frontend/React/ ./

# Modify vite.config.ts for Docker environment
# Beacuse we use Docker Compose to manage the backend and frontend services, we can use the service name as the hostname
RUN sed -i '/server: {/,/},/c\
    server: {\
    host: "0.0.0.0",\
    port: 8080,\
    proxy: {\
    "/solve": {\
    target: "http://backend:8002",\
    changeOrigin: true,\
    },\
    // "/solve": {\
    //   target: "https://mindsearch.openxlab.org.cn",\
    //   changeOrigin: true,\
    // },\
    },\
    },' vite.config.ts

# Start the development server
CMD ["npm", "start"]