-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathDockerfile.development
26 lines (23 loc) · 1.26 KB
/
Dockerfile.development
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Stage 1: Build the Go application
FROM golang:1.23.4-bullseye AS build
ARG GIT_COMMIT
WORKDIR /src/stellar-disbursement-platform
ADD go.mod go.sum ./
RUN go mod download
COPY . ./
RUN go build -o /bin/stellar-disbursement-platform -ldflags "-X main.GitCommit=$GIT_COMMIT" .
# Stage 2: Setup the development environment with Delve for debugging
FROM golang:1.23.4-bullseye AS development
# set workdir according to repo structure so remote debug source code is in sync
WORKDIR /app/github.com/stellar/stellar-disbursement-platform
RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/*
# Copy the built executable and all source files for debugging
COPY --from=build /src/stellar-disbursement-platform /app/github.com/stellar/stellar-disbursement-platform
# Build a debug version of the binary
RUN go build -gcflags="all=-N -l" -o stellar-disbursement-platform .
# Install Delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Ensure the binary has executable permissions
RUN chmod +x /app/github.com/stellar/stellar-disbursement-platform/stellar-disbursement-platform
EXPOSE 8001 2345
ENTRYPOINT ["/go/bin/dlv", "exec", "--continue", "--accept-multiclient", "--headless", "--listen=:2345", "--api-version=2", "--log", "./stellar-disbursement-platform"]