-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
49 lines (36 loc) · 1.31 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
# syntax=docker/dockerfile:experimental
FROM rust:1.78.0-bullseye as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates openssh-client git make protobuf-compiler
WORKDIR /tofnd
COPY ./Cargo.toml .
COPY ./Cargo.lock .
# build dependencies separately
RUN mkdir src && echo 'fn main() {}' > src/main.rs
RUN --mount=type=ssh cargo build --release
COPY src ./src
COPY proto ./proto
COPY build.rs ./build.rs
RUN rustup component add rustfmt
# read features argument. Use "default" because [ -z "$features" ] doesn't work
ARG features="default"
RUN echo "installing with features: ["$features"]"
# install tofnd
# use --locked for CI builds: https://doc.rust-lang.org/cargo/commands/cargo-install.html#manifest-options
RUN --mount=type=ssh if [ "$features" = "default" ]; then \
cargo install --locked --path .; \
else \
cargo install --locked --features ${features} --path .; \
fi
FROM debian:bullseye-slim as runner
RUN addgroup --system --gid 1001 axelard && adduser --system --uid 1000 --ingroup axelard axelard
RUN mkdir /.tofnd && chown axelard /.tofnd
USER axelard
COPY --from=builder /tofnd/target/release/tofnd /usr/local/bin
COPY ./entrypoint.sh /
VOLUME [ "/.tofnd" ]
ENV MNEMONIC_CMD ""
ENV NOPASSWORD ""
ENV TOFND_HOME ""
ENTRYPOINT ["/entrypoint.sh"]