mirror of
				https://github.com/TheLartians/ModernCppStarter.git
				synced 2025-10-31 18:21:35 +01:00 
			
		
		
		
	add docker multistage build
This commit is contained in:
		
							parent
							
								
									f0fe8d1cf6
								
							
						
					
					
						commit
						00008c553d
					
				
					 2 changed files with 69 additions and 0 deletions
				
			
		
							
								
								
									
										38
									
								
								docker/Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								docker/Dockerfile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| FROM ubuntu:20.04 as build | ||||
| # install dev tools | ||||
| ENV DEBIAN_FRONTEND=noninteractive | ||||
| RUN set -eux; \ | ||||
|     apt-get update; \ | ||||
|     apt-get install -y --no-install-recommends \ | ||||
|     ca-certificates \ | ||||
|     make \ | ||||
|     cmake \ | ||||
|     git \ | ||||
|     gcc \ | ||||
|     g++ \ | ||||
|     ; \ | ||||
|     rm -rf /var/lib/apt/lists/* | ||||
| # build in release mode | ||||
| WORKDIR /build-all | ||||
| COPY ./all ./all | ||||
| COPY ./cmake ./cmake | ||||
| COPY ./documentation ./documentation | ||||
| COPY ./include ./include | ||||
| COPY ./source ./source | ||||
| COPY ./standalone ./standalone | ||||
| COPY ./test ./test | ||||
| COPY ./CMakeLists.txt . | ||||
| RUN cmake -S all -B build -D CMAKE_BUILD_TYPE=Release | ||||
| RUN cmake --build build | ||||
| 
 | ||||
| # make a test image - could also be done directly from/in the build image | ||||
| FROM ubuntu:20.04 as test | ||||
| WORKDIR /test | ||||
| COPY --from=build /build-all/build/test/GreeterTests ./ | ||||
| CMD ["./GreeterTests"] | ||||
| 
 | ||||
| # make an image to deploy our 'app' | ||||
| FROM ubuntu:20.04 as deploy | ||||
| WORKDIR /app | ||||
| COPY --from=build /build-all/build/standalone/Greeter ./ | ||||
| CMD ["./Greeter"] | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue