-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (23 loc) · 866 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
39
40
41
42
43
44
ARG FEATURES='--features default'
FROM rust:latest AS chef
WORKDIR /app
RUN cargo install cargo-chef
# Planner layer with cargo-chef cli tool and projects sources to create recipe.json
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Builder layer with build project binaries based on previous planner layer
FROM chef AS builder
WORKDIR /app
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN echo -e 'building binary with feature "$FEATURES"'
RUN cargo install ${FEATURES} --bins --path .
# Target layer based on tiny official ubuntu image with neccessary binaries and data to run.
FROM ubuntu:rolling
RUN apt update && apt install -y curl
WORKDIR /app
COPY --from=builder /app/target/release/news-rss .
ENTRYPOINT ["/app/news-rss"]
EXPOSE 2865