Skip to content

Commit 10f7352

Browse files
committed
clean out superfluous changes
1 parent 2b842d4 commit 10f7352

File tree

12 files changed

+97
-263
lines changed

12 files changed

+97
-263
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
target/
2-
playground/
3-
crates/e2e/
42
Dockerfile

Dockerfile

Lines changed: 33 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,59 @@
1-
FROM debian:bookworm AS chef
2-
WORKDIR /src/
3-
RUN apt-get update && apt-get install -y curl git clang mold libssl-dev pkg-config git && apt-get clean
4-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5-
ENV PATH="$PATH:/root/.cargo/bin"
6-
RUN rustup component add clippy rustfmt
7-
# configure to use the fast linker
8-
RUN echo "\
9-
[build]\n \
10-
target = \"$(rustc -Vv | grep host | awk '{print $2}')\"\n \
11-
[target.$(rustc -Vv | grep host | awk '{print $2}')]\n \
12-
linker = \"clang\"\n \
13-
rustflags = [\"-C\", \"link-arg=-fuse-ld=/usr/bin/mold\"]\n \
14-
" > ~/.cargo/config.toml
15-
16-
RUN cargo install cargo-chef
17-
18-
FROM chef AS localdev
19-
# envs/tools suitable for running the stack locally
20-
ENV RUST_BACKTRACE=1
21-
RUN cargo install cargo-watch
22-
23-
FROM chef AS planner
24-
COPY . .
25-
RUN cargo chef prepare --recipe-path recipe.json
26-
271
FROM docker.io/flyway/flyway:10.7.1 AS migrations
282
COPY database/ /flyway/
293
CMD ["migrate"]
304

31-
FROM chef AS builder
32-
COPY --from=planner /src/recipe.json recipe.json
33-
# --mount=type=cache,target=./target,sharing=locked
34-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo chef cook --release --recipe-path recipe.json
5+
FROM docker.io/rust:1-slim-bookworm AS cargo-build
6+
WORKDIR /src/
357

36-
# Copy only the library crates for now
37-
# --mount=type=cache,target=./target,sharing=locked
38-
COPY Cargo.toml Cargo.lock ./
39-
COPY ./crates/app-data/ ./crates/app-data
40-
COPY ./crates/database/ ./crates/database
41-
COPY ./crates/bytes-hex/ ./crates/bytes-hex
42-
COPY ./crates/contracts/ ./crates/contracts
43-
COPY ./crates/shared/ ./crates/shared
44-
COPY ./crates/number/ ./crates/number
45-
COPY ./crates/model/ ./crates/model
46-
COPY ./crates/rate-limit/ ./crates/rate-limit
47-
COPY ./crates/chain/ ./crates/chain
48-
COPY ./crates/ethrpc/ ./crates/ethrpc
49-
COPY ./crates/observe/ ./crates/observe
50-
COPY ./crates/order-validation/ ./crates/order-validation
51-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package shared
52-
COPY ./crates/solver/ ./crates/solver
53-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package solver
8+
# Install dependencies
9+
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update && \
10+
apt-get install -y git libssl-dev pkg-config
11+
# Install Rust toolchain
12+
RUN rustup install stable && rustup default stable
5413

55-
# Create an base image for all the binaries
56-
FROM docker.io/debian:bookworm-slim AS base
14+
# Copy and Build Code
15+
COPY . .
16+
RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/src/target \
17+
CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release && \
18+
cp target/release/alerter / && \
19+
cp target/release/autopilot / && \
20+
cp target/release/driver / && \
21+
cp target/release/orderbook / && \
22+
cp target/release/refunder / && \
23+
cp target/release/solvers /
24+
25+
# Create an intermediate image to extract the binaries
26+
FROM docker.io/debian:bookworm-slim AS intermediate
5727
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update && \
5828
apt-get install -y ca-certificates tini gettext-base && \
5929
apt-get clean
6030

61-
FROM builder AS alerter-build
62-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package alerter
63-
64-
FROM base AS alerter
65-
COPY --from=alerter-build /src/target/release/alerter /usr/local/bin/alerter
31+
FROM intermediate AS alerter
32+
COPY --from=cargo-build /alerter /usr/local/bin/alerter
6633
ENTRYPOINT [ "alerter" ]
6734

68-
FROM builder AS autopilot-build
69-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package autopilot
70-
71-
FROM base AS autopilot
72-
COPY ./crates/autopilot/ ./crates/autopilot
73-
COPY --from=autopilot-build /src/target/release/autopilot /usr/local/bin/autopilot
35+
FROM intermediate AS autopilot
36+
COPY --from=cargo-build /autopilot /usr/local/bin/autopilot
7437
ENTRYPOINT [ "autopilot" ]
7538

76-
FROM builder AS driver-build
77-
COPY ./crates/driver/ ./crates/driver
78-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package driver
79-
80-
FROM base AS driver
81-
COPY --from=driver-build /src/target/release/driver /usr/local/bin/driver
39+
FROM intermediate AS driver
40+
COPY --from=cargo-build /driver /usr/local/bin/driver
8241
ENTRYPOINT [ "driver" ]
8342

84-
FROM builder AS orderbook-build
85-
COPY ./crates/orderbook/ ./crates/orderbook
86-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package orderbook
87-
88-
FROM base AS orderbook
89-
COPY --from=orderbook-build /src/target/release/orderbook /usr/local/bin/orderbook
43+
FROM intermediate AS orderbook
44+
COPY --from=cargo-build /orderbook /usr/local/bin/orderbook
9045
ENTRYPOINT [ "orderbook" ]
9146

92-
FROM builder AS refunder-build
93-
COPY ./crates/refunder/ ./crates/refunder
94-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package refunder
95-
96-
FROM base AS refunder
97-
COPY --from=refunder-build /src/target/release/refunder /usr/local/bin/refunder
47+
FROM intermediate AS refunder
48+
COPY --from=cargo-build /refunder /usr/local/bin/refunder
9849
ENTRYPOINT [ "refunder" ]
9950

100-
FROM builder AS solvers-build
101-
COPY ./crates/solvers/ ./crates/solvers
102-
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release --package solvers
103-
104-
FROM base AS solvers
105-
COPY --from=solvers-build /src/target/release/solvers /usr/local/bin/solvers
51+
FROM intermediate AS solvers
52+
COPY --from=cargo-build /solvers /usr/local/bin/solvers
10653
ENTRYPOINT [ "solvers" ]
10754

10855
# Extract Binary
109-
FROM base
56+
FROM intermediate
11057
RUN apt-get update && \
11158
apt-get install -y build-essential cmake git zlib1g-dev libelf-dev libdw-dev libboost-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libunwind-dev libzstd-dev git
11259
RUN git clone https://invent.kde.org/sdk/heaptrack.git /heaptrack && \

configs/baseline-lens-staging.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

configs/baseline-local.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.

configs/driver-lens-staging.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

configs/driver-local.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

configs/local/baseline.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.

configs/local/driver.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

playground/.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ENV=local
21
ETH_RPC_URL=wss://mainnet.gateway.tenderly.co
32
ACCOUNT_BALANCES=max
43
POSTGRES_USER=postgres

playground/Dockerfile.explorer

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
FROM docker.io/node:22-bookworm-slim as node-build
33
WORKDIR /usr/src/app
44

5+
# RPC URL args
6+
ARG REACT_APP_NETWORK_URL_1=https://rpc.mevblocker.io
7+
ARG REACT_APP_NETWORK_URL_5=https://ethereum-goerli.publicnode.com
8+
ARG REACT_APP_NETWORK_URL_100=https://gnosis.publicnode.com
9+
10+
# Orderbook URL args
11+
ARG REACT_APP_ORDER_BOOK_URLS='{"1":"https://api.cow.fi/mainnet","100":"https://api.cow.fi/goerli","5":"https://api.cow.fi/xdai"}'
12+
513
# Install dependencies
614
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update && \
715
apt-get install -y git libssl-dev pkg-config git autoconf automake file g++ libtool make python3
@@ -11,9 +19,40 @@ RUN git clone https://github.com/cowprotocol/cowswap . && \
1119
git submodule update --init --recursive
1220

1321
# Install npm dependencies
14-
RUN YARN_CACHE_FOLDER=/home/node/.yarn yarn install --frozen-lockfile
22+
RUN --mount=type=cache,target=/home/node/.yarn YARN_CACHE_FOLDER=/home/node/.yarn yarn install --frozen-lockfile
23+
24+
# Set the environment variable "chain"
25+
ARG chain
26+
ENV chain=$chain
27+
28+
# Set the environment variable "ETH_RPC_URL"
29+
ARG ETH_RPC_URL
30+
ENV ETH_RPC_URL=$ETH_RPC_URL
31+
32+
# Set the environment variables based on "chain" and "ETH_RPC_URL"
33+
ENV REACT_APP_NETWORK_URL_1=$REACT_APP_NETWORK_URL_1
34+
ENV REACT_APP_NETWORK_URL_5=$REACT_APP_NETWORK_URL_5
35+
ENV REACT_APP_NETWORK_URL_100=$REACT_APP_NETWORK_URL_100
36+
37+
# Update the REACT_APP_ORDER_BOOK_URLS based on the "chain" value if "ETH_RPC_URL" is set
38+
RUN if [ -n "$ETH_RPC_URL" ]; then \
39+
if [ "$chain" = "1" ]; then \
40+
export REACT_APP_ORDER_BOOK_URLS=$(echo $REACT_APP_ORDER_BOOK_URLS | jq --argjson chain 1 '.[$chain]="http://127.0.0.1:8080"'); \
41+
elif [ "$chain" = "5" ]; then \
42+
export REACT_APP_ORDER_BOOK_URLS=$(echo $REACT_APP_ORDER_BOOK_URLS | jq --argjson chain 5 '.[$chain]="http://127.0.0.1:8080"'); \
43+
elif [ "$chain" = "100" ]; then \
44+
export REACT_APP_ORDER_BOOK_URLS=$(echo $REACT_APP_ORDER_BOOK_URLS | jq --argjson chain 100 '.[$chain]="http://127.0.0.1:8080"'); \
45+
fi; \
46+
fi
1547

16-
ENV REACT_APP_ORDER_BOOK_URLS='{"1":"http://localhost:8080"}'
48+
# Update REACT_APP_NETWORK_URLs for the specific chain if "ETH_RPC_URL" is set
49+
RUN if [ -n "$ETH_RPC_URL" ]; then \
50+
case "$chain" in \
51+
1) export REACT_APP_NETWORK_URL_1=$ETH_RPC_URL;; \
52+
5) export REACT_APP_NETWORK_URL_5=$ETH_RPC_URL;; \
53+
100) export REACT_APP_NETWORK_URL_100=$ETH_RPC_URL;; \
54+
esac; \
55+
fi
1756

1857
# Build the frontend
1958
RUN APP_ID=1 yarn build:explorer

0 commit comments

Comments
 (0)