14 lines
		
	
	
		
			428 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
		
		
			
		
	
	
			14 lines
		
	
	
		
			428 B
		
	
	
	
		
			Docker
		
	
	
	
	
	
| 
								 | 
							
								# 构建阶段 - 使用国内镜像源
							 | 
						||
| 
								 | 
							
								FROM hub-mirror.c.163.com/library/node:16 AS build-stage
							 | 
						||
| 
								 | 
							
								WORKDIR /app
							 | 
						||
| 
								 | 
							
								COPY package*.json ./
							 | 
						||
| 
								 | 
							
								RUN npm install
							 | 
						||
| 
								 | 
							
								COPY . .
							 | 
						||
| 
								 | 
							
								RUN npm run build
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# 生产阶段 - 使用国内镜像源
							 | 
						||
| 
								 | 
							
								FROM hub-mirror.c.163.com/library/nginx:alpine AS production-stage
							 | 
						||
| 
								 | 
							
								COPY --from=build-stage /app/dist /usr/share/nginx/html
							 | 
						||
| 
								 | 
							
								COPY nginx.conf /etc/nginx/conf.d/default.conf
							 | 
						||
| 
								 | 
							
								EXPOSE 80
							 | 
						||
| 
								 | 
							
								CMD ["nginx", "-g", "daemon off;"]
							 |