0g-chain/Dockerfile
Robert Pirtle 1f82949c56 ci: update CI workflows and pipelines (#1768)
* build & publish rocksdb docker images merge to master
* publish docker images on push of release version tags

NOTE: New docker image tag pattern. ALL tags now include database suffix
ex. <githash>-goleveldb, v0.25.0-alpha.1-rocksdb, master-rocksdb, etc

* update dockerfiles for better caching
* update all github action workflow versions
* improve caching of go packages
* cache docker image layers for reuse between runs
* update dockerignore to remove non-essential files
2023-11-21 11:58:09 -08:00

38 lines
987 B
Docker

FROM golang:1.20-alpine AS build-env
# Set up dependencies
# bash, jq, curl for debugging
# git, make for installation
# 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
# Set working directory for the build
WORKDIR /root/kava
# default home directory is /root
# 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
# Add source files
COPY . .
#ENV LEDGER_ENABLED False
# Mount go build and mod caches as container caches, persisted between builder invocations
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
make install
FROM alpine:3.15
RUN apk add bash jq curl
COPY --from=build-env /go/bin/kava /bin/kava
CMD ["kava"]