Hi all,
I’m trying to debug the project https://github.com/evrone/go-clean-template by modifying the Dockerfile to use Delve and exposing port 40000. The Dockerfile builds successfully, and all services are up and running. However, when I try to send a GET request (curl -X 'GET' 'http://localhost:8080/v1/translation/history' -H 'accept: application/json'
)
, I get the following error:
curl: (52) Empty reply from server
original docker file :
https://github.com/evrone/go-clean-template/blob/master/Dockerfile
the modified docker file :
COPY go.mod go.sum /modules/
WORKDIR /modules
RUN go mod download
FROM golang:1.25-alpine3.21 AS builder
RUN apk add --no-cache git bash
COPY --from=modules /go/pkg /go/pkg
COPY . /app
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -gcflags "all=-N -l" -tags migrate -o /bin/app ./cmd/app
FROM golang:1.25-alpine3.21 AS debug
RUN apk add --no-cache bash ca-certificates git
ENV GOBIN=/usr/local/bin
RUN go install github.com/go-delve/delve/cmd/dlv@latest
COPY --from=builder /bin/app /app
COPY --from=builder /app/config /config
COPY --from=builder /app/migrations /migrations
WORKDIR /
EXPOSE 40000
CMD ["dlv", "exec", "/app", "--headless", "--listen=:40000", "--api-version=2", "--accept-multiclient"]
And somehow the get request on this endpoint : http://127.0.0.1:8080/swagger/index.html#/translation/history is running well, but the previously working curl -X 'GET' 'http://localhost:8080/v1/translation/history -> doesnt work anymore after including the dockerfile with delve
Can anyone advise why this is happening? Thanks in advance!