-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (28 loc) · 841 Bytes
/
Dockerfile
File metadata and controls
30 lines (28 loc) · 841 Bytes
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
##############################
# Stage 1: Prepare the Recipe
##############################
FROM rust:alpine AS chef
RUN cargo install cargo-chef
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
##############################
# Stage 2: Cache Dependencies
##############################
FROM rust:alpine AS builder
ENV RUSTFLAGS="-C target-feature=-crt-static"
RUN apk add --no-cache tesseract-ocr-dev leptonica-dev clang-dev
RUN cargo install cargo-chef
WORKDIR /app
COPY --from=chef /app/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release
##############################
# Stage 3: Final Image
##############################
FROM alpine:3
RUN apk add --no-cache tesseract-ocr
WORKDIR /app
COPY --from=builder /app/target/release/parser .
ENTRYPOINT ["./parser"]