-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile
More file actions
57 lines (49 loc) · 1.76 KB
/
Containerfile
File metadata and controls
57 lines (49 loc) · 1.76 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
# Use Ubuntu 18.04 - a classic base for older Python/C++ dependencies
FROM ubuntu:18.04
# Prevent prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# 1. Setup Architecture and Core Dependencies
# We add i386 support specifically for legacy 32-bit library requirements
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
build-essential \
cmake \
swig \
wget \
tar \
tcsh \
libc6:i386 \
libstdc++6:i386 && \
# Add PPA for Python 3.7 (which is deprecated in standard 18.04 repos)
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y python3.7 python3.7-dev python3-pip && \
rm -rf /var/lib/apt/lists/*
# 2. Python Environment Configuration
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1 && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
RUN python -m pip install --upgrade pip
# 3. Build OpenBabel from Source
WORKDIR /opt
RUN wget https://github.com/openbabel/openbabel/archive/refs/tags/openbabel-3-1-1.tar.gz -O openbabel.tar.gz && \
tar -xzf openbabel.tar.gz && \
rm openbabel.tar.gz && \
cd openbabel-openbabel-3-1-1 && \
mkdir build && \
cd build && \
cmake .. -DPYTHON_BINDINGS=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.7 && \
make -j$(nproc) && \
make install
# 4. Set Environment Variables for Compiled Libraries
ENV PYTHONPATH=/usr/local/lib/python3.7/site-packages
ENV LD_LIBRARY_PATH=/usr/local/lib
# 5. Application Setup
WORKDIR /app
COPY dependencies.txt .
RUN pip install --no-cache-dir -r dependencies.txt
COPY . .
RUN pip install -e .
# Define default command (optional)
CMD ["python3"]