Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1.2
FROM docker.io/library/golang:1.24-alpine3.21 AS builder

RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++
RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++ jemalloc-dev

WORKDIR /app
ADD go.mod go.mod
Expand All @@ -12,6 +12,9 @@ ADD erigon-lib/go.sum erigon-lib/go.sum
RUN go mod download
ADD . .

ENV CGO_CFLAGS="-I/usr/include/jemalloc"
ENV CGO_LDFLAGS="-ljemalloc"

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/tmp/go-build \
--mount=type=cache,target=/go/pkg/mod \
Expand All @@ -23,7 +26,7 @@ RUN --mount=type=cache,target=/root/.cache \
make smt-db-split

FROM docker.io/library/golang:1.24-alpine3.21 AS tools-builder
RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++
RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++ jemalloc-dev
WORKDIR /app

ADD Makefile Makefile
Expand All @@ -35,6 +38,9 @@ ADD erigon-lib/go.sum erigon-lib/go.sum

RUN mkdir -p /app/build/bin

ENV CGO_CFLAGS="-I/usr/include/jemalloc"
ENV CGO_LDFLAGS="-ljemalloc"

RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/tmp/go-build \
--mount=type=cache,target=/go/pkg/mod \
Expand All @@ -60,10 +66,10 @@ RUN --mount=type=cache,target=/root/.cache \
go install github.com/go-delve/delve/cmd/dlv@latest && \
cp /go/bin/dlv /app/build/bin/dlv

FROM docker.io/library/alpine:3.17
FROM docker.io/library/alpine:3.21

# install required runtime libs, along with some helpers for debugging
RUN apk add --no-cache ca-certificates libstdc++ tzdata
RUN apk add --no-cache ca-certificates libstdc++ tzdata jemalloc
RUN apk add --no-cache curl jq bind-tools
RUN apk add --no-cache perl perl-utils
RUN apk add --no-cache build-base git && \
Expand All @@ -75,6 +81,8 @@ RUN apk add --no-cache build-base git && \
RUN mkdir -p ~/.local/share/erigon
WORKDIR /home/erigon

ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"

## then give each binary its own layer
COPY --from=tools-builder /app/build/bin/mdbx_copy /usr/local/bin/mdbx_copy
COPY --from=tools-builder /app/build/bin/dlv /usr/local/bin/dlv
Expand Down