forked from kwilteam/kwil-streamr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkwil.dockerfile
31 lines (23 loc) · 917 Bytes
/
kwil.dockerfile
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
27
28
29
30
31
FROM golang:1.22.1-alpine3.19 AS build
WORKDIR /app
# let's add delve even if it's not debugging to make it available
RUN apk add --no-cache git \
&& go install github.com/go-delve/delve/cmd/dlv@latest
COPY . .
ARG DEBUG_PORT
ENV DEBUG_PORT=$DEBUG_PORT
# this file will help us to set the conditional env variables
RUN touch /etc/environment
# if DEBUG_PORT is set, we set GO_GCFLAGS and omit GO_LDFLAGS to avoid optimizations
RUN if [ "$DEBUG_PORT" != "" ]; then \
echo "export GO_GCFLAGS=\"all=-N -l\"" >> /etc/environment; \
echo "export GO_LDFLAGS=\" \"" >> /etc/environment; \
fi
RUN . /etc/environment && sh ./scripts/binary
ENTRYPOINT if [ "$DEBUG_PORT" != "" ]; then \
echo "Running in debug mode"; \
dlv --listen=:$DEBUG_PORT --headless=true --api-version=2 --accept-multiclient exec .build/kwil-streamr; \
else \
echo "Running in normal mode"; \
.build/kwil-streamr; \
fi