forked from kulupu/kulupu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (58 loc) · 2.18 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
# Copyright (c) 2019-2020 Wei Tang.
# Copyright (c) 2019 Polkasource.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ===== START FIRST STAGE ======
FROM phusion/baseimage:0.11 as builder
LABEL maintainer "[email protected]"
LABEL description="Kulupu builder."
ARG PROFILE=release
ARG STABLE=1.54.0
WORKDIR /rustbuilder
COPY . /rustbuilder/kulupu
# PREPARE OPERATING SYSTEM & BUILDING ENVIRONMENT
RUN apt-get update && \
apt-get install -y cmake pkg-config libssl-dev git clang libclang-dev
# UPDATE RUST DEPENDENCIES
ENV RUSTUP_HOME "/rustbuilder/.rustup"
ENV CARGO_HOME "/rustbuilder/.cargo"
RUN curl -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
ENV PATH "$PATH:/rustbuilder/.cargo/bin"
RUN rustup update $STABLE
# BUILD RUNTIME AND BINARY
RUN rustup target add wasm32-unknown-unknown --toolchain $STABLE
RUN cd /rustbuilder/kulupu && RUSTUP_TOOLCHAIN=$STABLE WASM_BUILD_TOOLCHAIN=$STABLE RUSTC_BOOTSTRAP=1 RANDOMX_ARCH=default cargo build --$PROFILE --locked
# ===== END FIRST STAGE ======
# ===== START SECOND STAGE ======
FROM phusion/baseimage:0.11
LABEL maintainer "[email protected]"
LABEL description="Kulupu binary."
ARG PROFILE=release
COPY --from=builder /rustbuilder/kulupu/target/$PROFILE/kulupu /usr/local/bin
# REMOVE & CLEANUP
RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/ && \
rm -rf /usr/lib/python* && \
mkdir -p /root/.local/share/kulupu && \
ln -s /root/.local/share/kulupu /data
RUN rm -rf /usr/bin /usr/sbin
# FINAL PREPARATIONS
EXPOSE 30333 9933 9944
VOLUME ["/data"]
#CMD ["/usr/local/bin/kulupu"]
WORKDIR /usr/local/bin
ENTRYPOINT ["kulupu"]
CMD ["--chain=kulupu"]
# ===== END SECOND STAGE ======