Skip to content

Commit 9ca0498

Browse files
committed
Build docker images to compile mmseqs and foldseek
1 parent 6d8d89b commit 9ca0498

File tree

3 files changed

+161
-0
lines changed

3 files changed

+161
-0
lines changed

.github/workflows/docker.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Create and publish Docker images
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
required: true
13+
type: string
14+
description: "Docker tag"
15+
latest:
16+
default: false
17+
type: boolean
18+
description: "Mark as latest"
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
jobs:
25+
build-and-push-gpu-builder:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- suffix: x86_64
35+
dockerfile: Dockerfile.GPU-manylinux2014
36+
- suffix: sbsa
37+
dockerfile: Dockerfile.GPU-buster-cross-sbsa
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v3
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v2
44+
45+
- name: Log in to the Container registry
46+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Extract metadata (tags, labels) for Docker
53+
id: meta
54+
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
flavor: |
58+
suffix=-${{ matrix.suffix }},onlatest=true
59+
60+
- name: Tag for workflow_dispatch
61+
id: dispatch_tag
62+
run: |
63+
if [ -n "$TAG" ]; then
64+
echo "tag=$FULL_TAG" >> $GITHUB_OUTPUT
65+
fi
66+
if [ "$LATEST" = "true" ]; then
67+
echo "latest=$LATEST_TAG" >> $GITHUB_OUTPUT
68+
fi
69+
env:
70+
FULL_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.tag }}
71+
LATEST_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
72+
TAG: ${{ github.event.inputs.tag }}
73+
LATEST: ${{ github.event.inputs.latest }}
74+
75+
- name: Build and push Docker image
76+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
77+
with:
78+
context: .
79+
file: ${{ matrix.dockerfile }}
80+
platforms: linux/amd64
81+
push: true
82+
build-args: |
83+
GPU=1
84+
tags: |
85+
${{ steps.meta.outputs.tags }}
86+
${{ steps.dispatch_tag.outputs.tag }}
87+
${{ steps.dispatch_tag.outputs.latest }}
88+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile.GPU-buster-cross-sbsa

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM debian:buster
2+
ARG VER="12-6"
3+
4+
RUN dpkg --add-architecture arm64
5+
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list; \
6+
sed -i s/security.debian.org/archive.debian.org/g /etc/apt/sources.list; \
7+
apt-get update; \
8+
apt-get -y install -o APT::Immediate-Configure=false \
9+
git curl wget vim ninja-build crossbuild-essential-arm64 zlib1g-dev:arm64 libbz2-dev:arm64 software-properties-common
10+
11+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.0/cmake-3.31.0-linux-x86_64.sh; \
12+
chmod +x cmake-3.31.0-linux-x86_64.sh; \
13+
./cmake-3.31.0-linux-x86_64.sh --skip-license --prefix=/usr/local;
14+
15+
RUN wget -O cuda-x64.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.1-1_all.deb
16+
RUN wget -O cuda-sbsa.deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/cross-linux-sbsa/cuda-keyring_1.1-1_all.deb
17+
RUN dpkg -i cuda-x64.deb && dpkg -i cuda-sbsa.deb
18+
RUN apt-get update
19+
RUN apt-get install -y cuda-nvcc-${VER} cuda-nvcc-cross-sbsa-${VER} cuda-cudart-cross-sbsa-${VER} libcublas-cross-sbsa-${VER}
20+
21+
RUN curl https://sh.rustup.rs -sSf | \
22+
sh -s -- --default-toolchain stable -y
23+
ENV PATH=/root/.cargo/bin:$PATH

Dockerfile.GPU-manylinux2014

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM quay.io/pypa/manylinux2014_x86_64
2+
ARG VER="12-6"
3+
ARG ARCH="x86_64"
4+
5+
# CUDA
6+
RUN yum install -y yum-utils
7+
RUN yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
8+
RUN yum -y install cuda-nvcc-${VER}.${ARCH} cuda-cudart-devel-${VER}.${ARCH} libcublas-devel-${VER}.${ARCH}
9+
RUN echo "/usr/local/cuda/lib64" >> /etc/ld.so.conf.d/999_nvidia_cuda.conf
10+
ENV PATH="/usr/local/cuda/bin:${PATH}"
11+
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
12+
ENV CUDA_HOME=/usr/local/cuda
13+
ENV CUDA_ROOT=/usr/local/cuda
14+
ENV CUDA_PATH=/usr/local/cuda
15+
ENV CUDADIR=/usr/local/cuda
16+
17+
# Build system
18+
RUN yum install -y git curl wget vim zlib-devel bzip2-devel ninja-build centos-release-scl
19+
RUN mv /etc/yum.repos.d/CentOS-SCLo-scl.repo /etc/yum.repos.d/CentOS-SCLo-scl.repo.disabled
20+
RUN yum install -y devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-libatomic-devel
21+
ENV CC=/opt/rh/devtoolset-11/root/bin/gcc
22+
ENV CXX=/opt/rh/devtoolset-11/root/bin/g++
23+
ENV CUDAHOSTCXX=/opt/rh/devtoolset-11/root/bin/g++
24+
ENV CUDACXX=/usr/local/cuda/bin/nvcc
25+
ENV LIBGCC=/opt/rh/devtoolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11
26+
27+
# cmake
28+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.0/cmake-3.31.0-linux-x86_64.sh; \
29+
chmod +x cmake-3.31.0-linux-x86_64.sh; \
30+
./cmake-3.31.0-linux-x86_64.sh --skip-license --prefix=/usr/local;
31+
32+
RUN mkdir /deps; \
33+
cd /deps; \
34+
wget https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz; \
35+
tar xzvf bzip2-1.0.8.tar.gz; \
36+
cd bzip2-1.0.8; \
37+
make install PREFIX=/deps;
38+
39+
RUN cd /deps; \
40+
wget https://www.zlib.net/zlib-1.3.1.tar.gz; \
41+
tar xzvf zlib-1.3.1.tar.gz; \
42+
cd zlib-1.3.1; \
43+
./configure --prefix=/deps --static; \
44+
make install;
45+
46+
# install toolchain
47+
RUN curl https://sh.rustup.rs -sSf | \
48+
sh -s -- --default-toolchain stable -y
49+
ENV PATH=/root/.cargo/bin:$PATH
50+

0 commit comments

Comments
 (0)