-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (40 loc) · 1.51 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
# syntax=docker/dockerfile:1
FROM python:3.10.12-bookworm
# Show print logs; don't write .pyc files.
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Install GIT
RUN apt update
RUN apt install -y git
# Clone the repository and enter the directory
RUN git clone https://github.com/konstantinosKokos/spindle.git
WORKDIR /spindle
# Install aethel
RUN pip install git+https://github.com/konstantinosKokos/aethel@41eab8fb178a197cdf8de738b68e386f07e6e4f5
# Install PyTorch and its dependencies
RUN pip3 install torch==1.12.0 opt_einsum --extra-index-url https://download.pytorch.org/whl/cpu
RUN pip3 install torch-geometric==2.3.1
RUN pip3 install --no-index \
torch-cluster \
torch-scatter \
torch-sparse \
torch-spline-conv -f https://data.pyg.org/whl/torch-1.12.0+cpu.html
RUN pip3 install transformers==4.20.1 six Flask
# Download BERTje model ahead of time
RUN python -c 'from transformers import pipeline; pipeline("fill-mask", model="GroNLP/bert-base-dutch-cased")'
# Install Gunicorn
RUN pip install gunicorn
# Create a directory for Gunicorn logs (production).
RUN mkdir -p /logs
# Copy data files
COPY atom_map.tsv data/atom_map.tsv
COPY bert_config.json data/bert_config.json
COPY model_weights.pt data/model_weights.pt
COPY app.py app.py
# Expose the port on which the Flask server will run
EXPOSE 32768
# Set the environment variable for Flask
ENV FLASK_APP=app.py
ENV FLASK_RUN_PORT=$SPINDLE_PORT
# Run the Flask server
CMD ["flask", "run", "--host=0.0.0.0"]