-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 993 Bytes
/
Dockerfile
File metadata and controls
44 lines (34 loc) · 993 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
42
43
44
# Build stage
FROM rust:latest as builder
WORKDIR /app
# Install build dependencies required for tesseract bindings and native crates
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
clang \
build-essential \
libtesseract-dev \
libleptonica-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy project
COPY Cargo.toml Cargo.lock* ./
COPY src ./src
# Build release binary
RUN cargo build --release
# Runtime stage
FROM rust:latest
# Install tesseract, language packs and runtime libs on the same distro base
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-all \
libtesseract5 \
libgomp1 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/target/release/optimo /usr/local/bin/optimo
# Create data directory for outputs
RUN mkdir -p /app/data
ENTRYPOINT ["optimo"]
CMD ["--help"]