-
Notifications
You must be signed in to change notification settings - Fork 17
/
Full.Dockerfile
66 lines (49 loc) · 1.69 KB
/
Full.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
64
65
66
# Use the latest official Rust image as the base
FROM rust:latest
# Use bash as the shell
SHELL ["/bin/bash", "-c"]
# Install NVM, Node.js, and Yarn
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
&& . $HOME/.nvm/nvm.sh \
&& nvm install 18 \
&& nvm alias default 18 \
&& nvm use default \
&& npm install -g yarn
# Set the working directory
WORKDIR /relayer
# Pre-configure Git to avoid common issues and increase clone verbosity
RUN git config --global advice.detachedHead false \
&& git config --global core.compression 0 \
&& git config --global protocol.version 2 \
&& git config --global http.postBuffer 1048576000 \
&& git config --global fetch.verbose true
# Copy project files
COPY . .
# Remove the packages/relayer directory
RUN rm -rf packages/relayer
# Install Yarn dependencies with retry mechanism
RUN . $HOME/.nvm/nvm.sh && nvm use default && yarn || \
(sleep 5 && yarn) || \
(sleep 10 && yarn)
# Install Foundry
RUN curl -L https://foundry.paradigm.xyz | bash \
&& source $HOME/.bashrc \
&& foundryup
# Verify Foundry installation
RUN source $HOME/.bashrc && forge --version
# Set the working directory for contracts
WORKDIR /relayer/packages/contracts
# Install Yarn dependencies for contracts
RUN source $HOME/.nvm/nvm.sh && nvm use default && yarn
# Build the contracts using Foundry
RUN source $HOME/.bashrc && forge build
# Copy the project files
COPY packages/relayer /relayer/packages/relayer
# Set the working directory for the Rust project
WORKDIR /relayer/packages/relayer
# Build the Rust project with caching
RUN cargo build
# Expose port
EXPOSE 4500
# Set the default command
CMD ["cargo", "run"]