-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (41 loc) · 1.31 KB
/
Dockerfile
File metadata and controls
50 lines (41 loc) · 1.31 KB
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
# Stage 1: Installing the cargo-chef utility
FROM rust:1.70-slim-bullseye AS chef
# sui specific
# Install basic dependencies
# + cargo chef
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y --no-install-recommends \
tzdata \
git-all \
ca-certificates \
curl \
build-essential \
libssl-dev \
pkg-config \
libclang-dev \
cmake \
&& rm -rf /var/lib/apt/lists/* \
&& cargo install cargo-chef
WORKDIR /app
# Stage 2: Preparing a list of dependencies using cargo-chef
FROM chef AS planner
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
WORKDIR /app
COPY --from=planner /app/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --bin byte-api
#RUN cargo install --path /app/crates/byte-api --verbose
# Create the final minimal image
FROM debian:bullseye-slim
# Install the ca-certificates and git packages
RUN apt-get update && apt-get install -y ca-certificates git && rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder to the final image
COPY --from=builder /app/target/release/byte-api .
# Specify the command to run your application
ENTRYPOINT ["/byte-api"]