summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 4e54bbfcdd36ce5a8df0ca86f3577af0f73e7355 (plain)
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
FROM rust AS chef
USER root
RUN cargo install cargo-chef
RUN apt-get update && apt-get install -y protobuf-compiler
WORKDIR /app

# Planning install
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

# Building all targets
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json

# Notice that we are specifying the --target flag!
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release 

# Base os
FROM debian:latest AS runtime-base
# RUN addgroup -S nova && adduser -S nova -G nova
RUN apt-get update && apt-get install ca-certificates -y

# Final os
FROM runtime-base AS runtime
ARG COMPONENT
ENV COMPONENT=${COMPONENT}
COPY --from=builder /app/target/release/${COMPONENT} /usr/local/bin/
# USER nova
ENTRYPOINT /usr/local/bin/${COMPONENT}