-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-debian
47 lines (39 loc) · 1.98 KB
/
Dockerfile-debian
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
# This is an example Dockerfile, demonstrating build process of rs-tenderdash-abci
# We use Debian base image, as Alpine has some segmentation fault issue
FROM rust:1.80.0-bookworm
SHELL ["/bin/bash", "-exc"]
RUN --mount=type=cache,sharing=locked,target=/var/lib/apt/lists \
--mount=type=cache,sharing=locked,target=/var/cache/apt \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get update -qq && \
apt-get install -qq --yes \
git \
wget \
bash
# Install protoc - protobuf compiler
# The one shipped with Alpine does not work
RUN if [[ "$BUILDPLATFORM" == "linux/arm64" ]] ; then export PROTOC_ARCH=aarch_64; else export PROTOC_ARCH=x86_64 ; fi; \
wget -q -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-${PROTOC_ARCH}.zip && \
unzip -qd /opt/protoc /tmp/protoc.zip && \
rm /tmp/protoc.zip && \
ln -s /opt/protoc/bin/protoc /usr/bin/
# Create a dummy package
RUN cargo init /usr/src/abci-app
WORKDIR /usr/src/abci-app
# revspec or SHA of commit/branch/tag to use
ARG REVISION="refs/heads/master"
# Add tenderdash-abci as a dependency and build the package
#
# Some notes here:
# 1. All these --mount... are to cache reusable info between runs.
# See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
# 2. We add `--config net.git-fetch-with-cli=true` to address ARM build issue,
# see https://github.com/rust-lang/cargo/issues/10781#issuecomment-1441071052
# 3. To preserve space on github cache, we call `cargo clean`.
RUN --mount=type=cache,sharing=shared,target=${CARGO_HOME}/registry/index \
--mount=type=cache,sharing=shared,target=${CARGO_HOME}/registry/cache \
--mount=type=cache,sharing=shared,target=${CARGO_HOME}/git/db \
cargo add --config net.git-fetch-with-cli=true \
--git https://github.com/dashpay/rs-tenderdash-abci --rev "${REVISION}" tenderdash-abci && \
cargo build --config net.git-fetch-with-cli=true && \
cargo clean