mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Update Dockerfile and add healthcheck
This commit is contained in:
		
							parent
							
								
									78c52861c7
								
							
						
					
					
						commit
						fb845c3e03
					
				
							
								
								
									
										15
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Dockerfile
									
									
									
									
									
								
							@ -45,10 +45,17 @@ ENV NODE_ENV production
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY --link --from=builder /app/next.config.js /app/.next/standalone ./
 | 
					# Copy files from context
 | 
				
			||||||
COPY --link --from=builder /app/public ./public/
 | 
					COPY --link package.json next.config.js ./
 | 
				
			||||||
COPY --link --from=builder /app/package.json ./package.json
 | 
					COPY --link --chmod=755 healthcheck.js ./
 | 
				
			||||||
COPY --link --from=builder /app/.next/static ./.next/static/
 | 
					COPY --link /public ./public
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Copy files from builder
 | 
				
			||||||
 | 
					COPY --link --from=builder /app/.next/standalone ./
 | 
				
			||||||
 | 
					COPY --link --from=builder /app/.next/static/ ./.next/static/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HEALTHCHECK --interval=12s --timeout=12s --start-period=30s \  
 | 
				
			||||||
 | 
					    CMD node ./healthcheck.js
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXPOSE 3000
 | 
					EXPOSE 3000
 | 
				
			||||||
ENV PORT 3000
 | 
					ENV PORT 3000
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								healthcheck.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								healthcheck.js
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					var http = require("http");
 | 
				
			||||||
 | 
					var options = {
 | 
				
			||||||
 | 
					  host: "localhost",
 | 
				
			||||||
 | 
					  port: "3000",
 | 
				
			||||||
 | 
					  timeout: 2000,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var request = http.request(options, (res) => {
 | 
				
			||||||
 | 
					  console.log(`STATUS: ${res.statusCode}`);
 | 
				
			||||||
 | 
					  if (res.statusCode == 200) {
 | 
				
			||||||
 | 
					    process.exit(0);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    process.exit(1);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					request.on("error", function (err) {
 | 
				
			||||||
 | 
					  console.log("ERROR");
 | 
				
			||||||
 | 
					  process.exit(1);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					request.end();
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user