forked from seferino-fernandez/ocr_service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (33 loc) · 1022 Bytes
/
Dockerfile
File metadata and controls
41 lines (33 loc) · 1022 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
31
32
33
34
35
36
37
38
39
40
41
FROM lukemathwalker/cargo-chef:0.1.71-rust-bookworm AS chef
WORKDIR /app
# Install dependencies for Tesseract Engine
RUN apt update && apt install -y \
lld \
clang \
pkg-config \
libssl-dev \
cmake \
g++
FROM chef AS planner
COPY . .
# Compute a lock-like file for our project
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Build project dependencies, not our application!
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin ocr_service
FROM debian:bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends ca-certificates \
curl \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ARG TESSDATA_PATH=tesseract
COPY --from=builder /app/$TESSDATA_PATH $TESSDATA_PATH
COPY --from=builder /app/target/release/ocr_service ocr_service
EXPOSE 8080
ENTRYPOINT ["./ocr_service"]