File tree Expand file tree Collapse file tree 5 files changed +63
-28
lines changed Expand file tree Collapse file tree 5 files changed +63
-28
lines changed Original file line number Diff line number Diff line change 1+ {
2+ // Use IntelliSense to learn about possible attributes.
3+ // Hover to view descriptions of existing attributes.
4+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+ "version" : " 0.2.0" ,
6+ "configurations" : [
7+ {
8+ "name" : " Remote Docker" ,
9+ "type" : " go" ,
10+ "request" : " launch" ,
11+ "mode" : " remote" ,
12+ "remotePath" :" /go/src/work/" ,
13+ "port" : 2345 ,
14+ "host" : " 127.0.0.1" ,
15+ "program" : " ${workspaceFolder}/golang/src/" ,
16+ "args" : [],
17+ "trace" : " verbose" ,
18+ "env" : {}
19+ }
20+ ]
21+ }
Original file line number Diff line number Diff line change @@ -14,20 +14,19 @@ services:
1414 - ./c#/src/:/work/
1515 ports :
1616 - 5000:5000
17- golang : # docker run -it -v ${PWD}:/work -w / work -p 5001:5000 aimvector/golang:1.0.0 /bin/sh
17+ golang : # docker run -it -v ${PWD}:/go/src/ work -p 5001:5000 -p 2345:2345 --security-opt "seccomp:unconfined" aimvector/golang:1.0.0
1818 container_name : golang
1919 image : aimvector/golang:1.0.0
2020 build :
2121 context : ./golang
22- target : prod
23- # working_dir: /work #comment out for build.target:prod
24- # entrypoint: /bin/sh #comment out for build.target:prod
25- # stdin_open: true #comment out for build.target:prod
26- # tty: true #comment out for build.target:prod
22+ target : debug
2723 volumes :
28- - ./golang/src/:/work
24+ - ./golang/src/:/go/src/ work/
2925 ports :
3026 - 5001:5000
27+ - 2345:2345
28+ security_opt :
29+ - " seccomp:unconfined"
3130 nodejs : # docker run -it -v ${PWD}:/work -w /work -p 5002:5000 aimvector/nodejs:1.0.0 /bin/sh
3231 container_name : nodejs
3332 image : aimvector/nodejs:1.0.0
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ cd /go/src/work
3+ dlv debug --headless --log -l 0.0.0.0:2345 --api-version=2
Original file line number Diff line number Diff line change 1- FROM golang:1.12.5-alpine3.9 as dev
2-
3- # installing git
4- RUN apk update && apk upgrade && \
5- apk add --no-cache git
6-
7- RUN go get github.com/sirupsen/logrus
8- RUN go get github.com/buaazp/fasthttprouter
9- RUN go get github.com/valyala/fasthttp
10-
11- WORKDIR /work
12- COPY ./src /work/
13- RUN go build -o app
14- ###########START NEW IMAGE###################
15-
16- FROM alpine:3.9 as prod
17- COPY --from=dev /work/app /
18- CMD ./app
1+ FROM golang:1.12.5-alpine3.9 as debug
2+
3+ # installing git
4+ RUN apk update && apk upgrade && \
5+ apk add --no-cache git \
6+ dpkg \
7+ gcc \
8+ git \
9+ musl-dev
10+
11+ ENV GOPATH /go
12+ ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
13+
14+ RUN go get github.com/sirupsen/logrus
15+ RUN go get github.com/buaazp/fasthttprouter
16+ RUN go get github.com/valyala/fasthttp
17+ RUN go get github.com/go-delve/delve/cmd/dlv
18+
19+ WORKDIR /go/src/work
20+ COPY ./src /go/src/work/
21+
22+ RUN go build -o app
23+ ### Run the Delve debugger ###
24+ COPY ./dlv.sh /
25+ RUN chmod +x /dlv.sh
26+ ENTRYPOINT [ "/dlv.sh"]
27+
28+ ###########START NEW IMAGE###################
29+
30+ FROM alpine:3.9 as prod
31+ COPY --from=debug /go/src/work/app /
32+ CMD ./app
Original file line number Diff line number Diff line change @@ -8,14 +8,12 @@ import (
88 "github.com/valyala/fasthttp"
99)
1010
11- var searchMock []byte
12-
1311func Response (ctx * fasthttp.RequestCtx ) {
1412 fmt .Fprintf (ctx , "Hello" )
1513}
1614func main () {
1715
18- fmt .Println ("starting." )
16+ fmt .Println ("starting... " )
1917
2018 router := fasthttprouter .New ()
2119 router .GET ("/" , Response )
You can’t perform that action at this time.
0 commit comments