-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·62 lines (51 loc) · 1.97 KB
/
Dockerfile
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
# build stage
FROM docker.io/ubuntu:20.04 AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3-venv python3-pip git curl
# build module
ENV PATH /root/.local/bin:/root/.poetry/bin:${PATH}
RUN mkdir -p /root/.local/bin \
&& ln -s $(which python3) /root/.local/bin/python \
&& curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
COPY . /root/app
WORKDIR /root/app
RUN poetry export --without-hashes -f requirements.txt > requirements.txt
RUN poetry build
# install stage
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
RUN apt-get update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git \
curl \
libgl1-mesa-glx \
libglib2.0-0
RUN : \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
software-properties-common \
&& add-apt-repository -y ppa:deadsnakes \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& :
RUN python3 --version
ENV VIRTUAL_ENV /opt/app/venv
ENV PATH ${VIRTUAL_ENV}/bin:${PATH}
RUN python3 -m venv $VIRTUAL_ENV \
&& /opt/app/venv/bin/python3 -m pip install --upgrade pip \
&& pip3 install wheel
COPY --from=builder /root/app/requirements.txt /tmp
RUN pip3 install -r /tmp/requirements.txt
COPY --from=builder /root/app/dist/*.whl /tmp
RUN pip3 install /tmp/*.whl
# Download model weights
RUN mkdir -p /model && curl -OJ https://nx9836.your-storageshare.de/s/gaqByayBJXcBmPQ/download && mv glomeruli_segmentation_16934_best_metric.model-384e1332.pth /model
ENV MODEL_PATH /model/glomeruli_segmentation_16934_best_metric.model-384e1332.pth
# Copy configuration file
COPY configuration.json /tmp
ENV CONFIG_PATH /tmp/configuration.json
CMD ["python3", "-m", "glomeruli_segmentation", "-v"]