forked from defi-wonderland/optimism
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.repro
More file actions
75 lines (61 loc) · 2.77 KB
/
Dockerfile.repro
File metadata and controls
75 lines (61 loc) · 2.77 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
ARG GO_VERSION=1.24.10-alpine3.21
ARG EXPORT_TARGET=current
FROM golang:${GO_VERSION} AS src
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash just
COPY ./go.mod /app/go.mod
COPY ./go.sum /app/go.sum
WORKDIR /app
RUN echo "go mod cache: $(go env GOMODCACHE)"
RUN echo "go build cache: $(go env GOCACHE)"
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go mod download
COPY . /app
# we need a separate stage for src so we can build a service provides prestates for unnanounced chains
FROM src AS builder
ARG EXPORT_TARGET
# We avoid copying the full .git dir into the build for just some metadata.
# Instead, specify:
# --build-arg GIT_COMMIT=$(git rev-parse HEAD)
# --build-arg GIT_DATE=$(git show -s --format='%ct')
ARG GIT_COMMIT
ARG GIT_DATE
ARG CANNON_VERSION=v0.0.0
ARG OP_PROGRAM_VERSION=v0.0.0
ARG TARGETOS TARGETARCH
WORKDIR /app
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build just \
-d /app/op-program \
-f /app/op-program/repro.justfile \
GOOS="$TARGETOS" \
GOARCH="$TARGETARCH" \
GIT_COMMIT="$GIT_COMMIT" \
GIT_DATE="$GIT_DATE" \
CANNON_VERSION="$CANNON_VERSION" \
OP_PROGRAM_VERSION="$OP_PROGRAM_VERSION" \
"build-${EXPORT_TARGET}"
FROM scratch AS export-current
# Cannon64 files
COPY --from=builder /app/op-program/bin/op-program-client64.elf .
COPY --from=builder /app/op-program/bin/meta-mt64.json .
COPY --from=builder /app/op-program/bin/prestate-mt64.bin.gz .
COPY --from=builder /app/op-program/bin/prestate-proof-mt64.json .
# Interop files
COPY --from=builder ./app/op-program/bin/op-program-client-interop.elf .
COPY --from=builder /app/op-program/bin/meta-interop.json .
COPY --from=builder /app/op-program/bin/prestate-interop.bin.gz .
COPY --from=builder /app/op-program/bin/prestate-proof-interop.json .
FROM scratch AS export-next
# Cannon64 Next VM files
COPY --from=builder /app/op-program/bin/op-program-client64.elf ./op-program-client-next64.elf
COPY --from=builder /app/op-program/bin/meta-mt64Next.json .
COPY --from=builder /app/op-program/bin/prestate-mt64Next.bin.gz .
COPY --from=builder /app/op-program/bin/prestate-proof-mt64Next.json .
# Interop Next files
COPY --from=builder ./app/op-program/bin/op-program-client-interop.elf ./op-program-client-interopNext.elf
COPY --from=builder /app/op-program/bin/meta-interopNext.json .
COPY --from=builder /app/op-program/bin/prestate-interopNext.bin.gz .
COPY --from=builder /app/op-program/bin/prestate-proof-interopNext.json .
# Exports files to the specified output location.
# Writing files to host requires buildkit to be enabled.
# e.g. `BUILDKIT=1 docker build ...`
# Final export stage — dynamically selected
FROM export-${EXPORT_TARGET} AS export-stage