Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AndrienkoAleksandr/883601653194ad1679447e303ede4cff to your computer and use it in GitHub Desktop.
Save AndrienkoAleksandr/883601653194ad1679447e303ede4cff to your computer and use it in GitHub Desktop.
Debug che-machine-exec
# Compile stage
FROM golang:1.10.1-alpine3.7 AS build-env
ENV CGO_ENABLED 0
ADD . /go/src/github.com/ws-skeleton/che-machine-exec
# The -gcflags "all=-N -l" flag helps us get a better debug experience
RUN go build -gcflags "all=-N -l" -o /server/che-machine-exec github.com/ws-skeleton/che-machine-exec
# Compile Delve
RUN apk add --no-cache git
RUN go get github.com/derekparker/delve/cmd/dlv
# Final stage
FROM alpine:3.7
# Port 8080 belongs to our application, 40000 belongs to Delve
EXPOSE 4444 40000
# Allow delve to run on Alpine based containers.
RUN apk add --no-cache libc6-compat
COPY --from=build-env /server/che-machine-exec /che-machine-exec
COPY --from=build-env /go/bin/dlv /
## Run delve
CMD ["/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "exec", "/che-machine-exec"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment