Skip to content

Commit e432912

Browse files
committed
fix
1 parent fc7c272 commit e432912

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

proposer/op/Dockerfile.op_proposer

+22-23
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
# Use a multi-stage build for efficiency
2-
FROM golang:1.22 AS go-builder
1+
# Build stage
2+
FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder
3+
4+
# Install build dependencies
5+
RUN apk add --no-cache make gcc musl-dev linux-headers git
6+
7+
# Set up cross-compilation
8+
ARG TARGETOS
9+
ARG TARGETARCH
10+
ENV GOOS=$TARGETOS
11+
ENV GOARCH=$TARGETARCH
12+
13+
# Install cross-compilation tools for ARM64
14+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
15+
apk add --no-cache gcc-aarch64-none-elf musl-dev; \
16+
fi
317

4-
# Set up Go environment
5-
FROM go-builder AS optimism-builder
618
WORKDIR /optimism
719

820
# Cache go modules
@@ -15,32 +27,19 @@ COPY ./proposer/op /optimism/op-proposer
1527
WORKDIR /optimism/op-proposer/proposer
1628
RUN --mount=type=cache,target=/root/.cache/go-build \
1729
make op-proposer
18-
RUN ls -l /optimism/op-proposer/proposer
19-
RUN ls -l /optimism/op-proposer/proposer/bin
20-
RUN pwd
2130

22-
# Use a slim Debian image for the final stage
23-
FROM ubuntu:22.04
31+
# Runtime stage
32+
FROM --platform=$TARGETPLATFORM ubuntu:22.04
2433

25-
# Install necessary dependencies
26-
RUN --mount=type=cache,target=/var/cache/apt \
27-
apt-get update && apt-get install -y \
34+
RUN apt-get update && apt-get install -y \
2835
ca-certificates \
2936
sqlite3 \
3037
&& rm -rf /var/lib/apt/lists/*
3138

32-
# Copy the built op-proposer binary from the previous stage
33-
COPY --from=optimism-builder /optimism/op-proposer/proposer/bin/op-proposer /usr/local/bin/op-proposer
34-
35-
# Set the entrypoint to run op-proposer with environment variables
36-
COPY ./proposer/op/op_proposer.sh /usr/local/bin/op_proposer.sh
37-
38-
# Copy the rollup configs
39+
COPY --from=builder /optimism/op-proposer/proposer/bin/op-proposer /usr/local/bin/
40+
COPY ./proposer/op/op_proposer.sh /usr/local/bin/
3941
COPY ../configs /configs
4042

41-
# Make the binary and entrypoint executable.
42-
RUN ls -l /usr/local/bin/
43-
RUN chmod +x /usr/local/bin/op-proposer
44-
RUN chmod +x /usr/local/bin/op_proposer.sh
43+
RUN chmod +x /usr/local/bin/op-proposer /usr/local/bin/op_proposer.sh
4544

4645
ENTRYPOINT ["/usr/local/bin/op_proposer.sh"]

0 commit comments

Comments
 (0)