forked from OpenWF/SpaceNinjaServer
		
	chore: print build date when started via docker (#2517)
Docker updates can be a bit confusing so this should help users know if they're up-to-date. Reviewed-on: OpenWF/SpaceNinjaServer#2517 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									2f642df20a
								
							
						
					
					
						commit
						922b65cfab
					
				@ -7,5 +7,6 @@ WORKDIR /app
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
RUN npm i --omit=dev
 | 
					RUN npm i --omit=dev
 | 
				
			||||||
RUN npm run build
 | 
					RUN npm run build
 | 
				
			||||||
 | 
					RUN date '+%d %B %Y' > BUILD_DATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENTRYPOINT ["/app/docker-entrypoint.sh"]
 | 
					ENTRYPOINT ["/app/docker-entrypoint.sh"]
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										12
									
								
								src/index.ts
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/index.ts
									
									
									
									
									
								
							@ -18,17 +18,23 @@ logger.info("Starting up...");
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Proceed with normal startup: bring up config watcher service, validate config, connect to MongoDB, and finally start listening for HTTP.
 | 
					// Proceed with normal startup: bring up config watcher service, validate config, connect to MongoDB, and finally start listening for HTTP.
 | 
				
			||||||
import mongoose from "mongoose";
 | 
					import mongoose from "mongoose";
 | 
				
			||||||
 | 
					import path from "path";
 | 
				
			||||||
import { JSONStringify } from "json-with-bigint";
 | 
					import { JSONStringify } from "json-with-bigint";
 | 
				
			||||||
import { startWebServer } from "@/src/services/webService";
 | 
					import { startWebServer } from "@/src/services/webService";
 | 
				
			||||||
 | 
					 | 
				
			||||||
import { validateConfig } from "@/src/services/configWatcherService";
 | 
					import { validateConfig } from "@/src/services/configWatcherService";
 | 
				
			||||||
import { updateWorldStateCollections } from "@/src/services/worldStateService";
 | 
					import { updateWorldStateCollections } from "@/src/services/worldStateService";
 | 
				
			||||||
 | 
					import { repoDir } from "@/src/helpers/pathHelper";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Patch JSON.stringify to work flawlessly with Bigints.
 | 
					JSON.stringify = JSONStringify; // Patch JSON.stringify to work flawlessly with Bigints.
 | 
				
			||||||
JSON.stringify = JSONStringify;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
validateConfig();
 | 
					validateConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fs.readFile(path.join(repoDir, "BUILD_DATE"), "utf-8", (err, data) => {
 | 
				
			||||||
 | 
					    if (!err) {
 | 
				
			||||||
 | 
					        logger.info(`Docker image was built on ${data.trim()}`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mongoose
 | 
					mongoose
 | 
				
			||||||
    .connect(config.mongodbUrl)
 | 
					    .connect(config.mongodbUrl)
 | 
				
			||||||
    .then(() => {
 | 
					    .then(() => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user