forked from pyrsia/pyrsia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (40 loc) · 1.23 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
# syntax=docker/dockerfile:1.3-labs
FROM rust:1.57-buster AS builder
ENV CARGO_TARGET_DIR=/target
WORKDIR /src
RUN apt-get update && apt-get install -y \
clang \
libclang-dev
FROM builder AS debug
COPY . .
FROM builder AS dupdatelock
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/local/cargo/registry/cache \
--mount=type=cache,target=/usr/local/cargo/registry/index \
cargo update
FROM scratch AS updatelock
COPY --from=dupdatelock /src/Cargo.lock .
FROM builder AS dbuild
RUN mkdir -p /out
ENV RUST_BACKTRACE=1
ENV DEV_MODE=on
ENV PYRSIA_ARTIFACT_PATH=pyrsia
RUN --mount=target=/src \
--mount=type=cache,target=/target \
--mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/local/cargo/registry/cache \
--mount=type=cache,target=/usr/local/cargo/registry/index \
cargo build --profile=release --package=pyrsia_node && cp /target/release/pyrsia_node /out/
FROM debian:buster-slim AS node
ENTRYPOINT ["pyrsia_node"]
ENV RUST_LOG=info
RUN <<EOT bash
set -e
apt-get update
apt-get install -y \
ca-certificates \
openssl
rm -rf /var/lib/apt/lists/*
EOT
COPY --from=dbuild /out/pyrsia_node /usr/local/bin/