On your pc

go web server

package main

import (
	"net/http"
	"github.com/gorilla/mux"
	"log"
	"github.com/urfave/negroni"
	"fmt"
)

func helloHandler(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	log.Println(vars)
	fmt.Fprint(w, "hello with fmt.Fprint")
}

func main() {
	router := mux.NewRouter()
	router.HandleFunc("/", helloHandler).Methods("GET")

	n := negroni.Classic()
	n.UseHandler(router)

	n.Run(":8080")
}

Dockerfile

FROM alpine:latest

RUN mkdir /app
WORKDIR /app
ADD for-raspi /app/for-raspi

CMD ["./for-raspi"]

Makefile

hello:
	cd /Users/huayun321
	pwd
build:
	GOOS=linux GOARCH=arm go build
	docker build -t raspi .
run:
	docker run -p 8080:8080 raspi
push:
	docker tag raspi huayun321/raspi
	docker push huayun321/raspi

On Raspberry Pi

install docker

curl -sSL https://get.docker.com | sh

DOCKER COMES TO RASPBERRY PI

pull your image then run

docker pull huayun321/raspi

docker run -p 8080:8080  huayun321/raspi