Modified codes to enable golang app in golang docker
parent
fa93d79b01
commit
89a64c6a6f
|
@ -17,6 +17,14 @@ services:
|
||||||
container_name: golang
|
container_name: golang
|
||||||
image: cruxlight/golang_sdk:1.0.0
|
image: cruxlight/golang_sdk:1.0.0
|
||||||
build: ./golang
|
build: ./golang
|
||||||
|
working_dir: /work
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- ./golang/src/:/work
|
||||||
|
ports:
|
||||||
|
- 5501:5000
|
||||||
nodejs:
|
nodejs:
|
||||||
container_name: nodejs
|
container_name: nodejs
|
||||||
image: cruxlight/nodejs:1.0.0
|
image: cruxlight/nodejs:1.0.0
|
||||||
|
|
|
@ -1 +1,9 @@
|
||||||
FROM golang:1.12.5-alpine3.9 as builder
|
FROM golang:1.12.5-alpine3.9 as builder
|
||||||
|
|
||||||
|
# installing git
|
||||||
|
RUN apk update && apk upgrade && \
|
||||||
|
apk add --no-cache git
|
||||||
|
|
||||||
|
RUN go get github.com/sirupsen/logrus
|
||||||
|
RUN go get github.com/buaazp/fasthttprouter
|
||||||
|
RUN go get github.com/valyala/fasthttp
|
|
@ -0,0 +1,24 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt" //to print messages to stdout
|
||||||
|
"log" //logging :)
|
||||||
|
//our web server that will host the mock
|
||||||
|
"github.com/buaazp/fasthttprouter"
|
||||||
|
"github.com/valyala/fasthttp"
|
||||||
|
)
|
||||||
|
|
||||||
|
var searchMock []byte
|
||||||
|
|
||||||
|
func Response(ctx *fasthttp.RequestCtx) {
|
||||||
|
fmt.Fprintf(ctx, "Hello")
|
||||||
|
}
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
fmt.Println("starting.")
|
||||||
|
|
||||||
|
router := fasthttprouter.New()
|
||||||
|
router.GET("/", Response)
|
||||||
|
|
||||||
|
log.Fatal(fasthttp.ListenAndServe(":5000", router.Handler))
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue