Skip to content

Commit 1763081

Browse files
Qizhong Maoautopear
authored andcommitted
Link to system-installed zmq without building
Signed-off-by: Qizhong Mao <[email protected]>
1 parent 5460339 commit 1763081

File tree

2 files changed

+3
-46
lines changed

2 files changed

+3
-46
lines changed

build/container/Dockerfile.gateway

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ ARG TARGETARCH
55

66
WORKDIR /workspace
77

8-
# Install build dependencies for static ZMQ
98
RUN apt-get update && apt-get install -y \
10-
build-essential cmake git wget pkg-config \
11-
libtool autoconf automake
12-
13-
# Build static libzmq
14-
COPY scripts/build-static-zmq.sh /tmp/
15-
RUN chmod +x /tmp/build-static-zmq.sh && /tmp/build-static-zmq.sh
9+
libkrb5-dev libzmq3-dev
1610

1711
# Copy the Go Modules manifests
1812
COPY go.mod go.mod
@@ -26,14 +20,9 @@ COPY cmd/ cmd/
2620
COPY api/ api/
2721
COPY pkg/ pkg/
2822

29-
# Build with static linking
30-
ENV CGO_ENABLED=1
31-
ENV CGO_LDFLAGS="-L/usr/local/lib -lzmq -lsodium -lstdc++ -lpthread -lm -static"
32-
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
33-
34-
RUN GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} \
23+
RUN GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} CGO_ENABLED=1 \
3524
go build -tags zmq \
36-
-ldflags '-extldflags "-static"' \
25+
-ldflags '-extldflags "-lzmq"' \
3726
-a -o gateway-plugins cmd/plugins/main.go
3827

3928
# Use distroless as minimal base image to package the manager binary

scripts/build-static-zmq.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)