-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
39 lines (28 loc) · 1.09 KB
/
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
32
33
34
35
36
37
38
39
FROM golang:1.22.3-alpine as builder
# Version to build. Default is the Git HEAD.
ARG VERSION="HEAD"
# Use muslc for static libs
ARG BUILD_TAGS="muslc"
RUN apk add --no-cache --update openssh git make build-base linux-headers libc-dev \
pkgconfig zeromq-dev musl-dev alpine-sdk libsodium-dev \
libzmq-static libsodium-static gcc
# Build
WORKDIR /go/src/github.com/babylonlabs-io/cli-tools
# Cache dependencies
COPY go.mod go.sum /go/src/github.com/babylonlabs-io/cli-tools/
RUN go mod download
# Copy the rest of the files
COPY ./ /go/src/github.com/babylonlabs-io/cli-tools/
RUN CGO_LDFLAGS="$CGO_LDFLAGS -lstdc++ -lm -lsodium" \
CGO_ENABLED=1 \
BUILD_TAGS=$BUILD_TAGS \
LINK_STATICALLY=true \
make build
# FINAL IMAGE
FROM alpine:3.16 AS run
RUN addgroup --gid 1138 -S cli-tools && adduser --uid 1138 -S cli-tools -G cli-tools
RUN apk add bash curl jq
COPY --from=builder /go/src/github.com/babylonlabs-io/cli-tools/build/cli-tools /bin/cli-tools
WORKDIR /home/cli-tools
RUN chown -R cli-tools /home/cli-tools
USER cli-tools