mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-05-09 12:35:24 -05:00
32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
diff --git i/Dockerfile w/Dockerfile
|
|
index 20b2b7a..60e3ee3 100644
|
|
--- i/Dockerfile
|
|
+++ w/Dockerfile
|
|
@@ -10,6 +10,8 @@ ARG build_string=pretendo.friends.docker
|
|
|
|
WORKDIR ${app_dir}
|
|
|
|
+RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
|
+
|
|
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
|
--mount=type=bind,source=go.sum,target=go.sum \
|
|
--mount=type=bind,source=go.mod,target=go.mod \
|
|
@@ -17,7 +19,7 @@ RUN --mount=type=cache,target=/go/pkg/mod/ \
|
|
|
|
COPY . .
|
|
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
|
- CGO_ENABLED=0 go build -v -o ${app_dir}/build/server -ldflags "-X 'main.serverBuildString=${build_string}'"
|
|
+ CGO_ENABLED=0 go build -v -o ${app_dir}/build/server -gcflags "all=-N -l" -ldflags "-X 'main.serverBuildString=${build_string}'"
|
|
|
|
|
|
# * Running the final application
|
|
@@ -31,6 +33,7 @@ RUN mkdir -p ${app_dir}/log && chown go:go ${app_dir}/log
|
|
|
|
USER go
|
|
|
|
+COPY --from=build /go/bin/dlv ${app_dir}/dlv
|
|
COPY --from=build ${app_dir}/build/server ${app_dir}/server
|
|
|
|
-CMD [ "./server" ]
|
|
+CMD ["./dlv", "exec", "./server", "--listen=:2345", "--headless", "--api-version=2", "--log", "--accept-multiclient", "--continue"]
|