added example
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					.idea/
 | 
				
			||||||
							
								
								
									
										3
									
								
								example/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								example/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					app
 | 
				
			||||||
 | 
					alpine*.img*
 | 
				
			||||||
 | 
					flash.sh
 | 
				
			||||||
							
								
								
									
										5
									
								
								example/build_image.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										5
									
								
								example/build_image.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker run --rm -v "$PWD":/work -w /work -e GOOS=linux -e GOARCH=arm -e GOARM=5 golang:1.13-alpine go build -v -o ./app .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker run --rm -it -v "$PWD":/input -v $PWD:/output bboehmke/raspi-alpine-builder
 | 
				
			||||||
							
								
								
									
										6
									
								
								example/image.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								example/image.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cp ${INPUT_PATH}/app ${ROOTFS_PATH}/usr/bin/test_app
 | 
				
			||||||
 | 
					cp ${INPUT_PATH}/init.sh ${ROOTFS_PATH}/etc/init.d/test_app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					chroot_exec rc-update add test_app default
 | 
				
			||||||
							
								
								
									
										13
									
								
								example/init.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								example/init.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					#!/sbin/openrc-run
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					command="/usr/bin/test_app"
 | 
				
			||||||
 | 
					pidfile="/var/run/test_app.pid"
 | 
				
			||||||
 | 
					command_args=""
 | 
				
			||||||
 | 
					command_background=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					depend() {
 | 
				
			||||||
 | 
						use logger dns
 | 
				
			||||||
 | 
						need net
 | 
				
			||||||
 | 
						after firewall
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								example/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								example/main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "net/http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func main() {
 | 
				
			||||||
 | 
						http.HandleFunc("/", func(writer http.ResponseWriter, _ *http.Request) {
 | 
				
			||||||
 | 
							writer.Write([]byte("It works!"))
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						http.ListenAndServe(":8080", nil)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user