-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (28 loc) · 865 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
FROM docker.io/library/rust:1-bookworm as builder
WORKDIR /build
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock ./
# cargo needs a dummy src/lib.rs to compile the dependencies
RUN mkdir -p src \
&& touch src/lib.rs \
&& cargo fetch --locked \
&& cargo build --release --offline \
&& rm -rf src
COPY . ./
RUN cargo build --release --frozen --offline
# Start building the final image
FROM docker.io/library/debian:bookworm-slim
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
WORKDIR /app
VOLUME /app/meals
COPY gitconfig /root/.gitconfig
COPY known_hosts /root/.ssh/known_hosts
COPY --from=builder /build/target/release/mensa-crawler /usr/bin/
ENTRYPOINT ["mensa-crawler"]