Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: docker caching #245

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions proposer/op/Dockerfile.op_proposer
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ FROM golang:1.22 AS go-builder
# Set up Go environment
FROM go-builder AS optimism-builder
WORKDIR /optimism

# Cache go modules
COPY ./proposer/op/go.mod ./proposer/op/go.sum /optimism/op-proposer/
WORKDIR /optimism/op-proposer
RUN go mod download

# Build the application
COPY ./proposer/op /optimism/op-proposer
WORKDIR /optimism/op-proposer/proposer
RUN make op-proposer
RUN --mount=type=cache,target=/root/.cache/go-build \
make op-proposer
RUN ls -l /optimism/op-proposer/proposer
RUN ls -l /optimism/op-proposer/proposer/bin
RUN pwd
Expand All @@ -15,7 +23,8 @@ RUN pwd
FROM ubuntu:22.04

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

Expand Down
12 changes: 9 additions & 3 deletions proposer/succinct/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# syntax=docker/dockerfile:1.4

# Final stage
FROM ubuntu:22.04

Expand Down Expand Up @@ -34,11 +36,15 @@ COPY utils ./utils
COPY programs ./programs

# Build the server
RUN cargo build --bin server --release
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --bin server --release && \
cp target/release/server /usr/local/bin/server

# Expose port based on environment variable or default to 3000
ENV PORT=${PORT:-3000}
EXPOSE $PORT

# Run the server
CMD ["/app/target/release/server"]
# Run the server from its permanent location
CMD ["/usr/local/bin/server"]
Loading