-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile-testnet
80 lines (59 loc) · 2.16 KB
/
Dockerfile-testnet
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
###Build Rosetta
FROM node:18 as builder-rosetta
WORKDIR /usr/src
RUN git clone https://github.com/gear-tech/rosetta-api.git .
RUN yarn install
RUN yarn build
###Build Gear
FROM ubuntu:22.04 as builder-gear
ARG PROFILE=production
# Install dependecies
RUN apt update -y && apt install -y clang gcc git gzip make tar wget unzip curl
RUN git clone https://github.com/gear-tech/gear.git
WORKDIR /gear
ARG PROTOC_ZIP=protoc-3.14.0-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
RUN unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
RUN unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
RUN rm -f $PROTOC_ZIP
# Install CMake v3
RUN wget https://cmake.org/files/v3.24/cmake-3.24.0-linux-x86_64.sh
RUN chmod +x cmake-3.24.0-linux-x86_64.sh
RUN ./cmake-3.24.0-linux-x86_64.sh --skip-license --prefix=/usr/local
RUN rm cmake-3.24.0-linux-x86_64.sh
RUN cmake --version
# Install Rust and toolchains
RUN wget https://sh.rustup.rs/rustup-init.sh
RUN chmod +x rustup-init.sh
RUN ./rustup-init.sh -y
ENV PATH="/root/.cargo/bin:$PATH"
#RUN rustup default stable
RUN rustup toolchain install nightly-2023-04-25
RUN rustup target add wasm32-unknown-unknown --toolchain nightly-2023-04-25
#RUN rustup update nightly && rustup target add wasm32-unknown-unknown --toolchain
# Build
RUN cargo build -p gear-cli --profile $PROFILE
### Final Image
FROM ubuntu:22.04
RUN apt update -y
RUN apt install wget curl vim xz-utils -y
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt install -y nodejs
RUN apt remove cmdtest -y
RUN apt remove yarn -y
RUN npm install -g yarn
RUN apt install supervisor -y
COPY --from=builder-rosetta /usr/src /opt/rosetta-api
ARG PROFILE=production
COPY --from=builder-gear /gear/target/$PROFILE/gear /usr/local/bin
RUN useradd -m -u 1000 -U -s /bin/sh -d /gear gear && \
mkdir -p /gear/.local/share && \
mkdir /data && \
chown -R gear:gear /data && \
ln -s /data /gear/.local/share/gear
USER root
# Copy conf files
COPY config/rosetta/vara-testnet.json /opt/vara-testnet.json
COPY supervisord-testnet.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 8080
CMD [ "/usr/bin/supervisord"]