forked from pyth-network/per
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (50 loc) · 2.21 KB
/
Dockerfile
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
ARG RUST_VERSION=1.66.1
# Get the solidity dependencies using npm
FROM node:21-alpine3.18 AS npm_build
WORKDIR /src
COPY contracts/evm contracts/evm
WORKDIR /src/contracts/evm
RUN npm install
FROM rust:${RUST_VERSION} AS build
# Latest version supporting anchor
RUN rustup default nightly-2024-02-04
RUN cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli --locked
# Install protobuf (modify version as needed)
ARG PROTOC_VERSION=28.3
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local && \
rm protoc-${PROTOC_VERSION}-linux-x86_64.zip
# Add /usr/local/bin to PATH if not already present
ENV PATH="/usr/local/bin:$PATH"
# Set default toolchain
RUN rustup default nightly-2024-04-10
# Install dependencies
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="${PATH}:/root/.foundry/bin/"
RUN foundryup
# Add contracts
WORKDIR /src
COPY contracts contracts
# Add solidity dependencies
COPY --from=npm_build /src/contracts/evm/node_modules/ /src/contracts/evm/node_modules/
WORKDIR /src/contracts/evm
RUN forge install foundry-rs/[email protected] --no-git --no-commit
RUN forge install OpenZeppelin/[email protected] --no-git --no-commit
RUN forge install OpenZeppelin/[email protected] --no-git --no-commit
RUN forge install Uniswap/permit2@0x000000000022D473030F116dDEE9F6B43aC78BA3 --no-git --no-commit
RUN forge install nomad-xyz/ExcessivelySafeCall@be417ab0c26233578b8d8f3a37b87bd1fcb4e286 --no-git --no-commit
# Build auction-server
WORKDIR /src
COPY auction-server auction-server
COPY gas-oracle gas-oracle
WORKDIR /src/auction-server
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release
# Build vault-simulator
WORKDIR /src
COPY vault-simulator vault-simulator
WORKDIR /src/vault-simulator
RUN --mount=type=cache,target=/root/.cargo/registry cargo build --release
FROM rust:${RUST_VERSION}
# Copy artifacts from other images
COPY --from=build /src/auction-server/target/release/auction-server /usr/local/bin/
COPY --from=build /src/vault-simulator/target/release/vault-simulator /usr/local/bin/