-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile.custom
More file actions
60 lines (41 loc) · 1.63 KB
/
Dockerfile.custom
File metadata and controls
60 lines (41 loc) · 1.63 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Custom build with local EVM plugin
ARG GO_VERSION=1.26
# ============= Go Installation Stage ================
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS go-installer
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ARG GO_VERSION
ARG BUILDPLATFORM
RUN BUILDARCH=$(echo ${BUILDPLATFORM} | cut -d / -f2) && \
wget -q "https://go.dev/dl/go${GO_VERSION}.linux-${BUILDARCH}.tar.gz" && \
tar -C /usr/local -xzf "go${GO_VERSION}.linux-${BUILDARCH}.tar.gz" && \
rm "go${GO_VERSION}.linux-${BUILDARCH}.tar.gz"
# ============= Compilation Stage ================
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS builder
COPY --from=go-installer /usr/local/go /usr/local/go
ENV PATH="/usr/local/go/bin:${PATH}"
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev make git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN [ -d ./build ] && rm -rf ./build/* || true
ENV CGO_ENABLED=0
RUN export GOARCH=amd64 && ./scripts/build.sh
# Copy local EVM plugin instead of downloading
ARG EVM_VM_ID=mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
RUN mkdir -p /luxd/build/plugins
COPY evm-plugin-linux-amd64 /luxd/build/plugins/${EVM_VM_ID}
RUN chmod +x /luxd/build/plugins/${EVM_VM_ID}
RUN mkdir -p /luxd/build
# ============= Runtime Stage ================
FROM debian:12-slim AS execution
COPY --from=builder /luxd/build /luxd/build
WORKDIR /luxd/build
COPY --from=builder /build/build/ .
RUN mkdir -p /luxd/build/plugins
CMD [ "./luxd" ]