cd: parametrize listen port
This commit is contained in:
		
							parent
							
								
									105b21badc
								
							
						
					
					
						commit
						4eaa75c843
					
				| @ -10,5 +10,7 @@ RUN pnpm build | ||||
| FROM nginx:stable-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;"] | ||||
| COPY startup.sh /docker-entrypoint.d/startup.sh | ||||
| ENV PORT 80 | ||||
| EXPOSE ${PORT} | ||||
| CMD ["nginx", "-g", "daemon off;"] | ||||
|  | ||||
							
								
								
									
										15
									
								
								startup.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								startup.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,15 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| # Generate the nginx.conf with PORT env or default to 80 | ||||
| cat > /etc/nginx/conf.d/default.conf <<EOF | ||||
| server { | ||||
|     listen ${PORT:-80}; | ||||
|     server_name localhost; | ||||
|     root /usr/share/nginx/html; | ||||
|     index index.html; | ||||
| 
 | ||||
|     location / { | ||||
|         try_files \$uri \$uri/ /index.html; | ||||
|     } | ||||
| } | ||||
| EOF | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user