From 03d490156a22210dccc0845326482f2563a0aaf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 12 Mar 2024 13:22:56 +0100 Subject: [PATCH] use Debian image for Dockerfile to fix build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise it fails with: ``` vendor/github.com/status-im/status-go/api/multiformat/utils.go:134:19: undefined: secp256k1.CompressPubkey vendor/github.com/status-im/status-go/api/multiformat/utils.go:186:20: undefined: secp256k1.DecompressPubkey vendor/github.com/status-im/status-go/protocol/identity/utils.go:72:19: undefined: secp256k1.CompressPubkey vendor/github.com/status-im/status-go/sqlite/sqlite.go:171:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:175:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:183:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:187:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:192:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:197:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:202:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/sqlite/sqlite.go:207:22: conn.Exec undefined (type *sqlite3.SQLiteConn has no field or method Exec) vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go:206:19: undefined: secp256k1.RecoverPubkey vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go:222:20: undefined: secp256k1.DecompressPubkey vendor/github.com/status-im/status-go/eth-node/crypto/gethcrypto.go:231:19: undefined: secp256k1.CompressPubkey vendor/github.com/waku-org/go-zerokit-rln/rln/serialize.go:14:16: undefined: appendLength vendor/github.com/waku-org/go-zerokit-rln/rln/serialize.go:28:16: undefined: appendLength vendor/github.com/waku-org/go-waku/waku/v2/protocol/relay/validators.go:125:20: undefined: secp256k1.VerifySignature vendor/github.com/waku-org/go-waku/waku/v2/protocol/relay/validators.go:132:25: undefined: secp256k1.Sig ``` Signed-off-by: Jakub SokoĊ‚owski --- Dockerfile | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0874b30f33..06c0f43f91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,30 @@ -FROM alpine AS builder +FROM golang:1.20-bullseye AS builder -COPY . /go/src/matterbridge -RUN apk --no-cache add go git \ - && cd /go/src/matterbridge \ - && CGO_ENABLED=0 go build -mod vendor -ldflags "-X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o /bin/matterbridge +RUN apt update +RUN apt install -y gcc g++ libc6-dev + +COPY . /go/src/github.com/42wim/matterbridge + +WORKDIR /go/src/github.com/42wim/matterbridge + +ENV GOPATH=/go + +RUN go mod tidy +RUN go mod vendor +RUN go build -o /bin/matterbridge + +FROM gcr.io/distroless/static-debian11 + +# Run ldd on binary in builder image to get a full list. +COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 +COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 +COPY --from=builder /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2 +COPY --from=builder /lib/x86_64-linux-gnu/libgcc_s.so.1 /lib/x86_64-linux-gnu/libgcc_s.so.1 +COPY --from=builder /lib/x86_64-linux-gnu/libm.so.6 /lib/x86_64-linux-gnu/libm.so.6 +COPY --from=builder /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread.so.0 +COPY --from=builder /lib/x86_64-linux-gnu/libresolv.so.2 /lib/x86_64-linux-gnu/libresolv.so.2 +COPY --from=builder /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -FROM alpine -RUN apk --no-cache add ca-certificates mailcap COPY --from=builder /bin/matterbridge /bin/matterbridge -RUN mkdir /etc/matterbridge \ - && touch /etc/matterbridge/matterbridge.toml \ - && ln -sf /matterbridge.toml /etc/matterbridge/matterbridge.toml -ENTRYPOINT ["/bin/matterbridge", "-conf", "/etc/matterbridge/matterbridge.toml"] + +ENTRYPOINT ["/bin/matterbridge"]