26
									
								
								react-nginx/Dockerfile
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								react-nginx/Dockerfile
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| # 1. For build React app | ||||
| FROM node:10 AS builder | ||||
| # Set working directory | ||||
| WORKDIR /app | ||||
| # Copy all files from current directory to working dir in image | ||||
| COPY . . | ||||
| # install all package and build project | ||||
| RUN npm install && npm run build | ||||
|  | ||||
| # 2. For Nginx setup | ||||
| FROM nginx:alpine | ||||
|  | ||||
| # Copy config nginx | ||||
| COPY --from=builder /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf | ||||
|  | ||||
| WORKDIR /usr/share/nginx/html | ||||
|  | ||||
| # Remove default nginx static assets | ||||
| RUN rm -rf ./* | ||||
|  | ||||
| # Copy static assets from builder stage | ||||
| COPY --from=builder /app/build . | ||||
|  | ||||
| # Containers run nginx with global directives and daemon off | ||||
| ENTRYPOINT ["nginx", "-g", "daemon off;"] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user