-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathDockerfile
120 lines (96 loc) · 2.71 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
FROM golang:1.22.7-bullseye AS lotus-build
# Lotus repository
ARG REPOSITORY="filecoin-project/lotus"
# Git branch of the lotus repository
ARG BRANCH="master"
# Filecoin network. Valid values: lotus(mainnet), calibnet
ARG NETWORK="lotus"
# Repo folder name
ARG FOLDER_NAME="lotus"
# Install packages required by lotus
RUN apt-get update && \
apt-get install -y --no-install-recommends \
mesa-opencl-icd \
ocl-icd-opencl-dev \
gcc \
git \
bzr \
jq \
pkg-config \
curl \
clang \
build-essential \
hwloc \
libhwloc-dev \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install lotus
RUN git clone https://github.com/${REPOSITORY}.git --depth 1 --branch $BRANCH $FOLDER_NAME && \
cd $FOLDER_NAME && \
make clean && \
make deps && \
make $NETWORK lotus-shed lotus-gateway && \
install -C ./lotus /usr/local/bin/lotus && \
install -C ./lotus-gateway /usr/local/bin/lotus-gateway && \
install -C ./lotus-shed /usr/local/bin/lotus-shed
FROM ubuntu:20.04 AS lotus-base
# Copy software dependencies
COPY --from=lotus-build \
/usr/lib/*/libhwloc.so.15 \
/usr/lib/*/libnuma.so.1 \
/usr/lib/*/libltdl.so.7 \
/lib/
# Copy OpenCL
COPY --from=lotus-build \
/usr/lib/*/libOpenCL.so.1.0.0 \
/lib/libOpenCL.so.1
# Copy SSL certificates
COPY --from=lotus-build \
/etc/ssl/certs \
/etc/ssl/certs
# Copy lotus binaries
COPY --from=lotus-build \
/usr/local/bin/lotus \
/usr/local/bin/lotus-gateway \
/usr/local/bin/lotus-shed \
/usr/local/bin/
FROM lotus-base AS lotus-runtime
# Install JQ
RUN apt-get update && \
apt-get install -y --no-install-recommends \
jq \
curl \
nano && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy lotus version
COPY LOTUS_VERSION /VERSION
# Copy lotus config
COPY config/config.toml /home/lotus_user/config.toml
# Copy the healthcheck script
COPY scripts/healthcheck /bin/
# Copy config scripts
COPY scripts/bash-config \
scripts/configure \
scripts/run \
scripts/launch \
/etc/lotus/docker/
# Create lotus group
RUN addgroup --gid 2000 lotus
# Create lotus user
RUN adduser --gid 2000 --uid 2000 --gecos "" --disabled-password --quiet lotus_user
# Add permissions for the lotus_user
RUN chown -R 2000:2000 /home/lotus_user
# # Add permissions for the group lotus
# RUN chmod 664 /home/lotus_user
#
# # Add permissions for the group lotus
# RUN chmod g+s /home/lotus_user
USER lotus_user
EXPOSE 1234/tcp
EXPOSE 1235/tcp
ENTRYPOINT ["/etc/lotus/docker/run"]