Statically linking go-sqlite3
This commit is contained in:
		
							parent
							
								
									e3bc92e158
								
							
						
					
					
						commit
						ad057c12c0
					
				
					 3 changed files with 24 additions and 2 deletions
				
			
		|  | @ -7,6 +7,9 @@ builds: | ||||||
|     binary: ntfy |     binary: ntfy | ||||||
|     env: |     env: | ||||||
|       - CGO_ENABLED=1 # required for go-sqlite3 |       - CGO_ENABLED=1 # required for go-sqlite3 | ||||||
|  |     tags: [sqlite_omit_load_extension] | ||||||
|  |     ldflags: | ||||||
|  |       - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" | ||||||
|     goos: [linux] |     goos: [linux] | ||||||
|     goarch: [amd64] |     goarch: [amd64] | ||||||
|   - |   - | ||||||
|  | @ -15,6 +18,9 @@ builds: | ||||||
|     env: |     env: | ||||||
|       - CGO_ENABLED=1 # required for go-sqlite3 |       - CGO_ENABLED=1 # required for go-sqlite3 | ||||||
|       - CC=arm-linux-gnueabi-gcc # apt install gcc-arm-linux-gnueabi |       - CC=arm-linux-gnueabi-gcc # apt install gcc-arm-linux-gnueabi | ||||||
|  |     tags: [sqlite_omit_load_extension] | ||||||
|  |     ldflags: | ||||||
|  |       - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" | ||||||
|     goos: [linux] |     goos: [linux] | ||||||
|     goarch: [arm] |     goarch: [arm] | ||||||
|     goarm: |     goarm: | ||||||
|  | @ -26,6 +32,9 @@ builds: | ||||||
|     env: |     env: | ||||||
|       - CGO_ENABLED=1 # required for go-sqlite3 |       - CGO_ENABLED=1 # required for go-sqlite3 | ||||||
|       - CC=aarch64-linux-gnu-gcc # apt install gcc-aarch64-linux-gnu |       - CC=aarch64-linux-gnu-gcc # apt install gcc-aarch64-linux-gnu | ||||||
|  |     tags: [sqlite_omit_load_extension] | ||||||
|  |     ldflags: | ||||||
|  |       - "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" | ||||||
|     goos: [linux] |     goos: [linux] | ||||||
|     goarch: [arm64] |     goarch: [arm64] | ||||||
| nfpms: | nfpms: | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -103,8 +103,9 @@ build-simple: clean | ||||||
| 	export CGO_ENABLED=1 | 	export CGO_ENABLED=1 | ||||||
| 	$(GO) build \
 | 	$(GO) build \
 | ||||||
| 		-o dist/ntfy_linux_amd64/ntfy \
 | 		-o dist/ntfy_linux_amd64/ntfy \
 | ||||||
|  | 		-tags sqlite_omit_load_extension \
 | ||||||
| 		-ldflags \
 | 		-ldflags \
 | ||||||
| 		"-s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" | 		"-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" | ||||||
| 
 | 
 | ||||||
| clean: .PHONY | clean: .PHONY | ||||||
| 	rm -rf dist build | 	rm -rf dist build | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
										
									
									
									
								
							|  | @ -146,8 +146,19 @@ rpm -ivh https://github.com/binwiederhier/ntfy/releases/download/v1.4.5/ntfy_1.4 | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| **Docker:** | **Docker:** | ||||||
|  | Without cache: | ||||||
|  | ``` | ||||||
|  | docker run -p 80:80 -it binwiederhier/ntfy | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | With cache: | ||||||
| ```bash | ```bash | ||||||
| docker run --rm -it binwiederhier/ntfy | docker run \ | ||||||
|  |   -v /var/cache/ntfy:/var/cache/ntfy \ | ||||||
|  |   -p 80:80 \ | ||||||
|  |   -it \ | ||||||
|  |   binwiederhier/ntfy \ | ||||||
|  |     --cache-file /var/cache/ntfy/cache.db | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| **Go:** | **Go:** | ||||||
|  | @ -200,3 +211,4 @@ Third party libraries and resources: | ||||||
| * [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) (MIT) is used to provide the persistent message cache | * [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) (MIT) is used to provide the persistent message cache | ||||||
| * [Firebase Admin SDK](https://github.com/firebase/firebase-admin-go) (Apache 2.0) is used to send FCM messages | * [Firebase Admin SDK](https://github.com/firebase/firebase-admin-go) (Apache 2.0) is used to send FCM messages | ||||||
| * [Lightbox with vanilla JS](https://yossiabramov.com/blog/vanilla-js-lightbox)  | * [Lightbox with vanilla JS](https://yossiabramov.com/blog/vanilla-js-lightbox)  | ||||||
|  | * [Statically linking go-sqlite3](https://www.arp242.net/static-go.html) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue