| 
						
						
						
					 | 
				
				 | 
				
					@ -1,13 +1,14 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM node:14 as builder | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /app | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM node:14-alpine as builder | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# build application and add additional files | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /ghostfolio | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# only add basic files without application itself to avoid rebuilding layers when package.json, etc. did not change | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./package.json package.json | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./yarn.lock yarn.lock | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./prisma/schema.prisma prisma/schema.prisma | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN yarn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# see https://github.com/nrwl/nx/issues/6586 for further details | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./decorate-angular-cli.js decorate-angular-cli.js | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN node decorate-angular-cli.js | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -22,14 +23,21 @@ COPY ./apps apps | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN yarn build:all | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./prisma/seed.ts prisma/seed.ts | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Prepare dist image with additional node_modules | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /ghostfolio/dist/apps/api | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# package.json was generated by build process, however the yarn.lock need to be used from the original to ensure same versions | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY ./yarn.lock /ghostfolio/dist/apps/api/yarn.lock | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN yarn | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY prisma /ghostfolio/dist/apps/api/prisma | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Overwrite generated package.json with original to ensure we have all the scripts | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY package.json /ghostfolio/dist/apps/api | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					RUN yarn database:generate-typings | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM node:14 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=builder /app/dist/apps /app/apps | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=builder /app/package.json /app/package.json | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# todo: change build to ensure that node_modules folder isn't required to reduce image size | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=builder /app/node_modules /app/node_modules | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=builder /app/prisma /app/prisma | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /app | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# Image to start, copy everything needed from builder | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					FROM node:14-alpine | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					WORKDIR /ghostfolio/apps/api | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					EXPOSE 3333 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					CMD [ "npm", "run", "start:prod" ] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					CMD [ "node", "main" ] | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |