-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
914b6f4
commit cba88d6
Showing
5 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Remote Docker", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "remote", | ||
"remotePath":"/go/src/work/", | ||
"port": 2345, | ||
"host": "127.0.0.1", | ||
"program": "${workspaceFolder}/golang/src/", | ||
"args": [], | ||
"trace" : "verbose", | ||
"env" : {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
cd /go/src/work | ||
dlv debug --headless --log -l 0.0.0.0:2345 --api-version=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
FROM golang:1.12.5-alpine3.9 as dev | ||
|
||
# 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 | ||
|
||
WORKDIR /work | ||
COPY ./src /work/ | ||
RUN go build -o app | ||
###########START NEW IMAGE################### | ||
|
||
FROM alpine:3.9 as prod | ||
COPY --from=dev /work/app / | ||
CMD ./app | ||
FROM golang:1.12.5-alpine3.9 as debug | ||
|
||
# installing git | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache git \ | ||
dpkg \ | ||
gcc \ | ||
git \ | ||
musl-dev | ||
|
||
ENV GOPATH /go | ||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH | ||
|
||
RUN go get github.com/sirupsen/logrus | ||
RUN go get github.com/buaazp/fasthttprouter | ||
RUN go get github.com/valyala/fasthttp | ||
RUN go get github.com/go-delve/delve/cmd/dlv | ||
|
||
WORKDIR /go/src/work | ||
COPY ./src /go/src/work/ | ||
|
||
RUN go build -o app | ||
### Run the Delve debugger ### | ||
COPY ./dlv.sh / | ||
RUN chmod +x /dlv.sh | ||
ENTRYPOINT [ "/dlv.sh"] | ||
|
||
###########START NEW IMAGE################### | ||
|
||
FROM alpine:3.9 as prod | ||
COPY --from=debug /go/src/work/app / | ||
CMD ./app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters