-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile.full
More file actions
63 lines (48 loc) · 1.88 KB
/
Dockerfile.full
File metadata and controls
63 lines (48 loc) · 1.88 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
62
63
ARG PYTHON_IMAGE=python:3.13-slim@sha256:bada92bcc2794014c291cd97ac3604eb907746b9d3f4b4ff5a8a1ffeff40ceff
# Keep the major/minor version in sync with packages/modelaudit-picklescan/Cargo.toml rust-version.
ARG PICKLESCAN_RUST_TOOLCHAIN=1.83.0
FROM ${PYTHON_IMAGE} AS builder
ARG PICKLESCAN_RUST_TOOLCHAIN
WORKDIR /build
COPY . .
RUN apt-get update \
&& apt-get install --yes --no-install-recommends --only-upgrade libc-bin libc6 \
&& apt-get install --yes --no-install-recommends build-essential ca-certificates curl \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal --default-toolchain "${PICKLESCAN_RUST_TOOLCHAIN}" \
&& PATH="/root/.cargo/bin:${PATH}" pip wheel --no-cache-dir --wheel-dir /wheels \
./packages/modelaudit-picklescan \
.
FROM ${PYTHON_IMAGE} AS runtime
WORKDIR /app
RUN apt-get update \
&& apt-get install --yes --no-install-recommends --only-upgrade libc-bin libc6 \
&& apt-get install --yes --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /wheels /wheels
RUN pip install --no-cache-dir /wheels/*.whl \
&& rm -rf /wheels
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN pip install --no-cache-dir \
"tensorflow-cpu>=2.13.0,<3.0" \
"h5py>=3.1,<4.0" \
"onnx>=1.12.0,<2.0" \
"scikit-learn>=1.0.0,<2.0"
RUN pip install --no-cache-dir \
"torch>=2.6.0,<3.0" --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir "setuptools>=78.1.1,<82"
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser \
&& mkdir -p /data \
&& chown appuser:appuser /data
USER appuser
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["--help"]