forked from lightsparkdev/go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
22 lines (15 loc) · 883 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM --platform=$BUILDPLATFORM golang:1.20-bookworm as builder
ARG TARGETOS TARGETARCH
RUN echo "$TARGETARCH" | sed 's,arm,aarch,;s,amd,x86_,' > /tmp/arch
RUN apt-get update && apt-get install -y "gcc-$(tr _ - < /tmp/arch)-linux-gnu" && apt-get clean && rm -rf /var/lib/apt/lists/*
ENV GOOS $TARGETOS
ENV GOARCH $TARGETARCH
COPY . /src
RUN go env
RUN cd /src/examples/remote-signing-server && CGO_ENABLED=1 CC=$(cat /tmp/arch)-linux-gnu-gcc go install
RUN if [ -e /go/bin/${TARGETOS}_${TARGETARCH} ]; then mv /go/bin/${TARGETOS}_${TARGETARCH}/* /go/bin/; fi
FROM debian:bookworm as final
RUN addgroup --system --gid 1000 go && adduser --system --uid 1000 --ingroup go go
RUN apt-get update && apt-get -y install ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists
COPY --from=builder /go/bin/remote-signing-server /usr/local/bin
ENTRYPOINT ["remote-signing-server"]