forked from huishenlab/tranquillyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (51 loc) · 1.96 KB
/
Dockerfile
File metadata and controls
64 lines (51 loc) · 1.96 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
64
# ------------------------------------------------------------
# Stage 1: builder (micromamba)
# ------------------------------------------------------------
FROM mambaorg/micromamba:1.5.5 AS builder
ARG MAMBA_DOCKERFILE_ACTIVATE=1
ENV MAMBA_ROOT_PREFIX=/opt/conda
ENV PATH=${MAMBA_ROOT_PREFIX}/bin:$PATH
# tensorrt (pulled by tensorflow[and-cuda]) calls `ps` during build;
# `ps` is provided by the procps package (missing in micromamba base image)
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
procps \
&& rm -rf /var/lib/apt/lists/*
USER $MAMBA_USER
WORKDIR /build
COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /build/environment.yml
# Install into base instead of creating a new env
RUN micromamba install -y -n base -f /build/environment.yml && \
micromamba clean --all --yes
# ------------------------------------------------------------
# Stage 2: runtime image
# ------------------------------------------------------------
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# You use curl + unzip below for optional model download; install them.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Copy conda env from builder
COPY --from=builder /opt/conda /opt/conda
ENV PATH=/opt/conda/bin:$PATH
# LD_LIBRARY_PATH expansion
ENV LD_LIBRARY_PATH=/opt/conda/lib
WORKDIR /app
COPY . .
# Optional model download (expects MODEL_ZIP_URL at build time)
ARG MODEL_ZIP_URL
RUN if [ -n "$MODEL_ZIP_URL" ]; then \
echo "Downloading model bundle from $MODEL_ZIP_URL"; \
mkdir -p models && \
curl -L "$MODEL_ZIP_URL" -o /tmp/models.zip && \
unzip /tmp/models.zip -d models && \
rm /tmp/models.zip; \
else \
echo "MODEL_ZIP_URL not provided; skipping model download."; \
fi
ARG SETUPTOOLS_SCM_PRETEND_VERSION
RUN rm -rf *.egg-info && pip install --no-cache-dir .
CMD ["tranquillyzer", "--help"]