2024-03-22 13:40:18 +00:00
|
|
|
FROM golang:1.21-alpine AS build-env
|
2019-11-25 19:24:46 +00:00
|
|
|
|
|
|
|
# Set up dependencies
|
2020-09-01 15:35:37 +00:00
|
|
|
# bash, jq, curl for debugging
|
2019-11-25 19:24:46 +00:00
|
|
|
# git, make for installation
|
2020-09-01 15:35:37 +00:00
|
|
|
# libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation
|
|
|
|
RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl
|
2019-11-25 19:24:46 +00:00
|
|
|
|
|
|
|
# Set working directory for the build
|
|
|
|
WORKDIR /root/kava
|
|
|
|
# default home directory is /root
|
|
|
|
|
2023-11-08 22:06:03 +00:00
|
|
|
# Copy dependency files first to facilitate dependency caching
|
|
|
|
COPY ./go.mod ./
|
|
|
|
COPY ./go.sum ./
|
|
|
|
|
|
|
|
# Download dependencies
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
go version && go mod download
|
|
|
|
|
2019-11-25 19:24:46 +00:00
|
|
|
# Add source files
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
#ENV LEDGER_ENABLED False
|
2022-04-21 20:16:28 +00:00
|
|
|
|
|
|
|
# Mount go build and mod caches as container caches, persisted between builder invocations
|
2022-01-08 00:39:27 +00:00
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
2022-04-21 20:16:28 +00:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
2022-01-08 00:39:27 +00:00
|
|
|
make install
|
|
|
|
|
|
|
|
FROM alpine:3.15
|
|
|
|
|
|
|
|
RUN apk add bash jq curl
|
|
|
|
COPY --from=build-env /go/bin/kava /bin/kava
|
2019-11-25 19:24:46 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
CMD ["kava"]
|