|
| 1 | +# syntax=docker/dockerfile:1.7 |
| 2 | + |
| 3 | +############################ |
| 4 | +# Stage 1: builder |
| 5 | +############################ |
| 6 | +FROM --platform=linux/amd64 golang:1.25.5-bookworm AS builder |
| 7 | + |
| 8 | +ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo |
| 9 | +ENV PATH=/usr/local/cargo/bin:$PATH |
| 10 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 11 | + build-essential \ |
| 12 | + ca-certificates \ |
| 13 | + curl \ |
| 14 | + make \ |
| 15 | + pkg-config \ |
| 16 | + && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ |
| 17 | + | sh -s -- -y --default-toolchain stable --profile minimal \ |
| 18 | + && rm -rf /var/lib/apt/lists/* |
| 19 | + |
| 20 | +WORKDIR /src |
| 21 | + |
| 22 | +COPY go.mod go.sum ./ |
| 23 | +RUN go mod download |
| 24 | + |
| 25 | +COPY . . |
| 26 | + |
| 27 | +# Validator node binary + both conformance binaries (tiny and full specs). |
| 28 | +RUN make build \ |
| 29 | + && make build-conformance \ |
| 30 | + && make build-conformance-full |
| 31 | + |
| 32 | +# Dev-only ed25519 key pair for the baked test_validators.json (normal mode). |
| 33 | +RUN mkdir -p /out && go run docker/gen-validators.go > /out/test_validators.json |
| 34 | + |
| 35 | +############################ |
| 36 | +# Stage 2: runtime |
| 37 | +############################ |
| 38 | +FROM --platform=linux/amd64 debian:bookworm-slim |
| 39 | + |
| 40 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 41 | + ca-certificates \ |
| 42 | + && rm -rf /var/lib/apt/lists/* \ |
| 43 | + && useradd --create-home --uid 1000 strawberry |
| 44 | + |
| 45 | +WORKDIR /app |
| 46 | + |
| 47 | +COPY --from=builder /src/strawberry /app/strawberry |
| 48 | +COPY --from=builder /src/pkg/conformance/bin/strawberry /app/strawberry-conformance-tiny |
| 49 | +COPY --from=builder /src/pkg/conformance/bin/strawberry-full /app/strawberry-conformance-full |
| 50 | +COPY --from=builder /src/appconfig.json /app/appconfig.json |
| 51 | +COPY --from=builder /out/test_validators.json /app/test_validators.json |
| 52 | +COPY --from=builder /src/docker/entrypoint.sh /app/entrypoint.sh |
| 53 | + |
| 54 | +RUN sed -i 's/"validatorIndex": *[0-9]*/"validatorIndex": 0/' /app/appconfig.json \ |
| 55 | + && chmod +x /app/entrypoint.sh \ |
| 56 | + && chown -R strawberry:strawberry /app |
| 57 | + |
| 58 | +USER strawberry |
| 59 | +EXPOSE 30000/udp |
| 60 | + |
| 61 | +ENTRYPOINT ["/app/entrypoint.sh"] |
0 commit comments