-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
59 lines (43 loc) · 2.22 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
FROM python:3.10-slim-bullseye AS base
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
apt-get -y update && apt-get install -y \
procps \
libglib2.0-0 libgl1-mesa-glx libsm6 libxext6 \
curl build-essential git libssl-dev wget unzip \
libxrender-dev libcairo2-dev
ENV PATH="${PATH}:/app"
FROM base AS dependency
# Create user
RUN useradd -ms /bin/bash app \
&& mkdir /app \
&& chown -R app:0 /app \
&& chmod g=u -R /app
WORKDIR /app
# Pip install
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
pip install --no-warn-script-location torch==1.12.1+cpu torchvision==0.13.1+cpu -f https://download.pytorch.org/whl/torch_stable.html \
&& pip install --no-warn-script-location pytorch_lightning==2.0.2 torch-geometric==2.3.1 \
scikit-learn seaborn timm mahotas more_itertools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
pip install --no-warn-script-location rdkit-pypi CairoSVG SmilesPE python-Levenshtein \
nltk ipykernel ipython rouge-score opencv-python \
albumentations paddleocr paddlepaddle \
torchsummary weighted-levenshtein
FROM dependency AS specific
WORKDIR /app
# Copy repositories
COPY --chown=app:0 . /app/MolGrapher/
# Pip install
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
pip install -e /app/MolGrapher/ \
&& pip install -e /app/MolGrapher/MolDepictor/
FROM specific AS production
WORKDIR /app
# Download model
RUN wget https://huggingface.co/ds4sd/MolGrapher/resolve/main/models/graph_classifier/gc_gcn_model.ckpt -O /app/MolGrapher/data/models/graph_classifier/gc_gcn_model.ckpt
RUN wget https://huggingface.co/ds4sd/MolGrapher/resolve/main/models/graph_classifier/gc_no_stereo_model.ckpt -O /app/MolGrapher/data/models/graph_classifier/gc_no_stereo_model.ckpt
RUN wget https://huggingface.co/ds4sd/MolGrapher/resolve/main/models/graph_classifier/gc_stereo_model.ckpt -O /app/MolGrapher/data/models/graph_classifier/gc_stereo_model.ckpt
RUN wget https://huggingface.co/ds4sd/MolGrapher/resolve/main/models/keypoint_detector/kd_model.ckpt -O /app/MolGrapher/data/models/keypoint_detector/kd_model.ckpt
RUN chmod ugo+rwx -R /app
WORKDIR /app/MolGrapher/molgrapher/scripts/annotate/
CMD ["/bin/sh", "./run.sh"]