Create a docker image for running the server.
This commit is contained in:
		
							parent
							
								
									c20927b726
								
							
						
					
					
						commit
						b122e6ee99
					
				| @ -1,2 +1,4 @@ | ||||
| **/.git | ||||
| target/ | ||||
| docker/ | ||||
| .dockerignore | ||||
|  | ||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +1,2 @@ | ||||
| /target | ||||
| TODO.org | ||||
|  | ||||
| @ -7,7 +7,7 @@ description = "Trigger tekton jobs with gitea webhooks." | ||||
| license = "0BSD" | ||||
| repository = "https://code.fizz.buzz/talexander/webhook_bridge" | ||||
| readme = "README.md" | ||||
| keywords = ["gitea", "webhook"] | ||||
| keywords = ["tekton", "gitea", "webhook"] | ||||
| categories = ["development-tools"] | ||||
| resolver = "2" | ||||
| include = [ | ||||
|  | ||||
							
								
								
									
										15
									
								
								docker/webhook_bridge/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								docker/webhook_bridge/Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| FROM rustlang/rust:nightly-alpine3.20 AS builder | ||||
| 
 | ||||
| RUN apk add --no-cache musl-dev pkgconfig libressl-dev | ||||
| 
 | ||||
| RUN mkdir /source | ||||
| WORKDIR /source | ||||
| COPY . . | ||||
| # TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static" | ||||
| RUN CARGO_TARGET_DIR=/target cargo build --profile release-lto | ||||
| 
 | ||||
| FROM alpine:3.20 AS runner | ||||
| 
 | ||||
| COPY --from=builder /target/release-lto/webhook_bridge /usr/bin/ | ||||
| 
 | ||||
| ENTRYPOINT ["/usr/bin/webhook_bridge"] | ||||
							
								
								
									
										31
									
								
								docker/webhook_bridge/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								docker/webhook_bridge/Makefile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| SHELL := bash | ||||
| .ONESHELL: | ||||
| .SHELLFLAGS := -eu -o pipefail -c | ||||
| .DELETE_ON_ERROR: | ||||
| MAKEFLAGS += --warn-undefined-variables | ||||
| MAKEFLAGS += --no-builtin-rules | ||||
| 
 | ||||
| ifeq ($(origin .RECIPEPREFIX), undefined) | ||||
|   $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) | ||||
| endif | ||||
| .RECIPEPREFIX = > | ||||
| 
 | ||||
| IMAGE_NAME:=webhook-bridge | ||||
| TARGET := | ||||
| 
 | ||||
| .PHONY: help | ||||
| help: | ||||
| > @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1:  /'
 | ||||
| 
 | ||||
| .PHONY: build | ||||
| build: ## Build the docker image.
 | ||||
| > docker build --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile ../../ | ||||
| 
 | ||||
| .PHONY: shell | ||||
| shell: ## Launch an interactive shell inside the docker image with the source repository mounted at /source.
 | ||||
| shell: build | ||||
| > docker run --rm -i -t --entrypoint /bin/sh --mount type=tmpfs,destination=/tmp $(IMAGE_NAME) | ||||
| 
 | ||||
| .PHONY: clean | ||||
| clean: | ||||
| > docker rmi $(IMAGE_NAME) | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander