Skip to content

Instantly share code, notes, and snippets.

@dlsniper
Created June 18, 2017 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlsniper/890620182178e90323bb789a6f346021 to your computer and use it in GitHub Desktop.
Save dlsniper/890620182178e90323bb789a6f346021 to your computer and use it in GitHub Desktop.
Debug Dockerfile for Go applications
# build stage
FROM golang:1.8.3 AS build-env
ADD . /go/src/github.com/dlsniper/webinar
RUN go build -gcflags="-N -l" -o /webinar github.com/dlsniper/webinar
# final stage
FROM ubuntu:16.04
WORKDIR /
COPY --from=build-env /webinar /
ADD dlv /
RUN chmod +x /dlv /webinar
EXPOSE 8000 40000
CMD ["/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "exec", "/webinar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment