-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
68 lines (48 loc) · 1.59 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
64
65
66
67
68
FROM debian:stable-slim
ARG USER=sui
ARG FORCE_TAG
# Set environment variables
ENV USER=${USER}
ENV HOME=/home/${USER}
# Create user and setup permissions on /etc/sudoers
RUN apt-get update && apt-get install -y sudo
RUN useradd -m -s /bin/bash ${USER}
RUN usermod -aG sudo ${USER}
RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${USER} && chmod 0440 /etc/sudoers.d/${USER}
RUN echo "${USER}:${USER}" | chpasswd
# Copy start.sh to home directory and make it executable
COPY start.sh /home/${USER}/start.sh
RUN chmod +x /home/${USER}/start.sh
RUN chown ${USER}:${USER} /home/${USER}/start.sh
# Switch to user
USER ${USER}
WORKDIR ${HOME}
# Install dependencies
RUN sudo apt-get update && sudo apt-get install -y \
lsof curl git-all cmake gcc libssl-dev pkg-config libclang-dev libpq-dev build-essential
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Add Rust to PATH
ENV PATH="$HOME/.local/bin:$HOME/.cargo/bin:${PATH}"
RUN rustup update stable
# Clone and install suibase
RUN cd ~
RUN git clone https://github.com/chainmovers/suibase.git ./suibase
RUN cd ./suibase && ./install
RUN localnet create
ENV FORCE_TAG=${FORCE_TAG}
ENV config=${HOME}/suibase/workdirs/localnet/suibase.yaml
# if FORCE_TAG is set, then checkout to the specified tag
RUN if [ -n "$FORCE_TAG" ]; then \
echo '' >> $config; \
echo 'force_tag: "${FORCE_TAG}"' >> $config; \
localnet update; \
fi
RUN localnet start && localnet stop
# Expose ports
EXPOSE 9000
EXPOSE 44340
EXPOSE 44380
## Start script
ENTRYPOINT ["/bin/bash"]
CMD ["-c", "./start.sh && exec /bin/bash"]