Merged in feature/debug-queryapi (pull request #170)
new compose and dockerfile * new compose and dockerfile * add task docker:build:debug * update readme * Merged main into feature/debug-queryapi
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG GO_VERSION=1.24.0
|
||||
|
||||
FROM golang:${GO_VERSION} AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir bin/
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends git=1:2.* musl-tools=1.2.* && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Delve debugger with static linking for Alpine
|
||||
RUN CGO_ENABLED=0 go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
|
||||
RUN go install -a -installsuffix cgo std
|
||||
|
||||
COPY --link go.mod .
|
||||
COPY --link go.sum .
|
||||
COPY --link vendor/ vendor/
|
||||
|
||||
RUN go mod verify
|
||||
|
||||
COPY --link cmd/ cmd/
|
||||
COPY --link api/ api/
|
||||
COPY --link internal/ internal/
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
ENV CGO_ENABLED=1
|
||||
ENV GOARCH=${TARGETARCH}
|
||||
ENV CC=musl-gcc
|
||||
|
||||
ARG GIT_VERSION=dev
|
||||
ARG GIT_COMMIT=unknown
|
||||
|
||||
# Build with debug symbols (remove -s -w flags)
|
||||
RUN go build \
|
||||
-mod vendor \
|
||||
-tags musl \
|
||||
-trimpath \
|
||||
-installsuffix cgo \
|
||||
-gcflags="all=-N -l" \
|
||||
-ldflags "-linkmode external -extldflags '-static -Wl,--as-needed -Wl,--gc-sections -Wl,-O1' -X main.version=${GIT_VERSION} -X main.gitCommit=${GIT_COMMIT}" \
|
||||
-o bin/ ./cmd/...
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS final
|
||||
|
||||
ENV PWD=/app
|
||||
|
||||
WORKDIR ${PWD}
|
||||
|
||||
# Install ca-certificates
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
# Copy Delve from build stage
|
||||
COPY --from=build /go/bin/dlv /dlv
|
||||
|
||||
COPY --from=build /app/bin/ .
|
||||
|
||||
EXPOSE 8080 2345
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=1s --retries=10 \
|
||||
CMD ["./healthcheck"]
|
||||
Reference in New Issue
Block a user