forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (31 loc) · 903 Bytes
/
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
# Stage 1: Build
FROM lukemathwalker/cargo-chef:latest-rust-1.67 as chef
WORKDIR /build/
# hadolint ignore=DL3008
RUN apt-get update && \
apt-get install -y --no-install-recommends \
lld \
clang \
libclang-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
FROM chef as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
COPY --from=planner /build/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release -p forc --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release -p forc
# Stage 2: Run
FROM ubuntu:20.04 as run
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libssl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /root/
COPY --from=builder /build/target/release/forc .
CMD ["exec", "./forc"]