| 
									
										
										
										
											2023-08-10 20:34:56 -04:00
										 |  |  | IMAGE_NAME:=organic-build | 
					
						
							|  |  |  | # REMOTE_REPO:=harbor.fizz.buzz/private
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: all | 
					
						
							|  |  |  | all: build push | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: build | 
					
						
							|  |  |  | build: | 
					
						
							| 
									
										
										
										
											2023-09-06 16:03:59 -04:00
										 |  |  | 	docker build -t $(IMAGE_NAME) -f Dockerfile . | 
					
						
							| 
									
										
										
										
											2023-08-10 20:34:56 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | .PHONY: push | 
					
						
							|  |  |  | push: | 
					
						
							|  |  |  | ifdef REMOTE_REPO | 
					
						
							|  |  |  | 	docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME) | 
					
						
							|  |  |  | 	docker push $(REMOTE_REPO)/$(IMAGE_NAME) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 	@echo "REMOTE_REPO not defined, not pushing to a remote repo." | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .PHONY: clean | 
					
						
							|  |  |  | clean: | 
					
						
							|  |  |  | 	docker rmi $(IMAGE_NAME) | 
					
						
							|  |  |  | ifdef REMOTE_REPO | 
					
						
							|  |  |  | 	docker rmi $(REMOTE_REPO)/$(IMAGE_NAME) | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 	@echo "REMOTE_REPO not defined, not removing from remote repo." | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2023-08-27 17:53:51 -04:00
										 |  |  | 	docker volume rm cargo-cache | 
					
						
							| 
									
										
										
										
											2023-08-10 20:34:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-27 17:29:55 -04:00
										 |  |  | # NOTE: This target will write to folders underneath the git-root
 | 
					
						
							| 
									
										
										
										
											2023-08-10 20:34:56 -04:00
										 |  |  | .PHONY: run | 
					
						
							| 
									
										
										
										
											2023-08-27 17:51:57 -04:00
										 |  |  | run: build | 
					
						
							| 
									
										
										
										
											2023-08-31 21:23:51 -04:00
										 |  |  | 	docker run --rm --init --read-only --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry $(IMAGE_NAME) | 
					
						
							| 
									
										
										
										
											2023-08-10 20:34:56 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | .PHONY: shell | 
					
						
							| 
									
										
										
										
											2023-08-27 17:51:57 -04:00
										 |  |  | shell: build | 
					
						
							| 
									
										
										
										
											2023-08-31 21:23:51 -04:00
										 |  |  | 	docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp -v "$$(readlink -f ../../):/source" --workdir=/source --mount source=cargo-cache,target=/usr/local/cargo/registry $(IMAGE_NAME) |