Container related files
This commit is contained in:
		
							parent
							
								
									7be09fc6eb
								
							
						
					
					
						commit
						afe10b8b07
					
				
					 1 changed files with 29 additions and 0 deletions
				
			
		
							
								
								
									
										29
									
								
								container/Containerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								container/Containerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,29 @@
 | 
				
			||||||
 | 
					# Client/frontend build in an isolated stage
 | 
				
			||||||
 | 
					# We use node:latest as the base image.
 | 
				
			||||||
 | 
					# Essentially we build the frontend SPA with vite and 
 | 
				
			||||||
 | 
					# make it available in the public directory.
 | 
				
			||||||
 | 
					FROM docker.io/node:latest as client
 | 
				
			||||||
 | 
					WORKDIR /build
 | 
				
			||||||
 | 
					ADD frontend /build
 | 
				
			||||||
 | 
					RUN npm install
 | 
				
			||||||
 | 
					RUN npm run build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Builds the server in an isolated stage
 | 
				
			||||||
 | 
					FROM docker.io/golang:latest as go
 | 
				
			||||||
 | 
					ADD backend /build
 | 
				
			||||||
 | 
					WORKDIR /build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Copy the frontend SPA build into public
 | 
				
			||||||
 | 
					COPY --from=client /build/dist /build/static
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Get the dependencies
 | 
				
			||||||
 | 
					RUN go mod download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# RUN go build -o server
 | 
				
			||||||
 | 
					RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o ./server ./cmd/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Expose port 8080
 | 
				
			||||||
 | 
					EXPOSE 8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Run the server
 | 
				
			||||||
 | 
					CMD ["./server"]
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue