-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
61 lines (46 loc) · 1.58 KB
/
Copy pathContainerfile
File metadata and controls
61 lines (46 loc) · 1.58 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM docker.io/library/rust:1-trixie AS builder
ARG APP_NAME=florence2-base-inference-server
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY docs/openapi.json ./docs/openapi.json
RUN set -eux; \
cargo build --release --locked; \
mkdir -p /out/bin /out/lib; \
cp "target/release/${APP_NAME}" /out/bin/; \
find target/release target/release/deps \
-maxdepth 1 \
\( -type f -o -type l \) \
\( -name '*.so' -o -name '*.so.*' \) \
-exec cp -L '{}' /out/lib/ \;
FROM docker.io/library/debian:trixie-slim AS runtime
ARG APP_NAME=florence2-base-inference-server
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
libstdc++6 \
libssl3 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --uid 10001 --home-dir /app --create-home --shell /usr/sbin/nologin florence
WORKDIR /app
COPY --from=builder /out/bin/${APP_NAME} /usr/local/bin/${APP_NAME}
COPY --from=builder /out/lib/ /usr/local/lib/
COPY config.example.toml /app/config.example.toml
RUN mkdir -p /app/data /app/Florence-2-base \
&& chown -R florence:florence /app
ENV BIND_ADDR=0.0.0.0:3000 \
DATA_DIR=/app/data \
LD_LIBRARY_PATH=/usr/local/lib \
RUST_LOG=info,ort=warn
USER florence
EXPOSE 3000
VOLUME ["/app/data", "/app/Florence-2-base"]
STOPSIGNAL SIGTERM
ENTRYPOINT ["florence2-base-inference-server"]