Skip to content

Commit

Permalink
Fix container build
Browse files Browse the repository at this point in the history
  • Loading branch information
HippocampusGirl committed Feb 6, 2024
1 parent 8e74b03 commit 59e5426
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 118 deletions.
58 changes: 28 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# syntax=docker/dockerfile:1.4

FROM ubuntu:rolling as base

ENV LC_ALL="C.UTF-8" \
LANG="C.UTF-8" \
DEBIAN_FRONTEND="noninteractive" \
DEBCONF_NOWARNINGS="yes" \
PATH="/usr/local/mambaforge/bin:$PATH"
PATH="/opt/conda/bin:$PATH"

RUN apt-get update && \
apt-get install --yes --no-install-recommends \
Expand All @@ -26,7 +28,7 @@ FROM base as conda
RUN curl --silent --show-error --location \
"https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh" \
--output "conda.sh" && \
bash conda.sh -b -p /usr/local/mambaforge && \
bash conda.sh -b -p /opt/conda && \
rm conda.sh && \
conda config --system --append channels "bioconda" && \
conda config --system --prepend channels "conda-forge/label/cython_dev" && \
Expand All @@ -40,53 +42,49 @@ FROM conda as builder
RUN mamba install --yes "boa" "conda-verify"
COPY recipes/conda_build_config.yaml /root/conda_build_config.yaml

COPY recipes/bolt-lmm bolt-lmm
RUN conda mambabuild --no-anaconda-upload "bolt-lmm" && \
conda build purge

COPY recipes/dosage-convertor dosage-convertor
RUN conda mambabuild --no-anaconda-upload "dosage-convertor" && \
RUN --mount=source=recipes/bolt-lmm,target=/bolt-lmm \
conda mambabuild --no-anaconda-upload "bolt-lmm" && \
conda build purge

COPY recipes/gcta gcta
RUN conda mambabuild --no-anaconda-upload "gcta" && \
RUN --mount=source=recipes/dosage-convertor,target=/dosage-convertor \
conda mambabuild --no-anaconda-upload "dosage-convertor" && \
conda build purge

COPY recipes/qctool qctool
RUN conda mambabuild --no-anaconda-upload "qctool" && \
RUN --mount=source=recipes/gcta,target=/gcta \
conda mambabuild --no-anaconda-upload "gcta" && \
conda build purge

COPY recipes/raremetal raremetal
RUN conda mambabuild --no-anaconda-upload "raremetal" && \
RUN --mount=source=recipes/qctool,target=/qctool \
conda mambabuild --no-anaconda-upload "qctool" && \
conda build purge

COPY recipes/r-gmmat r-gmmat
RUN conda mambabuild --no-anaconda-upload "r-gmmat" && \
RUN --mount=source=recipes/raremetal,target=/raremetal \
conda mambabuild --no-anaconda-upload "raremetal" && \
conda build purge

COPY recipes/r-saige r-saige
RUN conda mambabuild --no-anaconda-upload "r-saige" && \
RUN --mount=source=recipes/r-gmmat,target=/r-gmmat \
conda mambabuild --no-anaconda-upload "r-gmmat" && \
conda build purge

COPY recipes/python-blosc2 python-blosc2
RUN conda mambabuild --no-anaconda-upload "python-blosc2" && \
RUN --mount=source=recipes/r-saige,target=/r-saige \
conda mambabuild --no-anaconda-upload "r-saige" && \
conda build purge

COPY src/gwas gwas-protocol/src/gwas
COPY recipes/gwas gwas-protocol/recipes/gwas
# copy .git folder too for setuptools_scm
COPY .git gwas-protocol/.git
RUN cd gwas-protocol/recipes && \
# mount .git folder too for setuptools_scm
RUN --mount=source=recipes/gwas,target=/gwas-protocol/recipes/gwas \
--mount=source=src/gwas,target=/gwas-protocol/src/gwas \
--mount=source=.git,target=/gwas-protocol/.git \
cd gwas-protocol/recipes && \
conda mambabuild --no-anaconda-upload "gwas" && \
conda build purge

RUN conda index /usr/local/mambaforge/conda-bld
RUN conda index /opt/conda/conda-bld

# Install packages
# ================
FROM conda as install

COPY --from=builder /usr/local/mambaforge/conda-bld /usr/local/mambaforge/conda-bld
COPY --from=builder /opt/conda/conda-bld /opt/conda/conda-bld
RUN mamba install --yes --use-local \
"python=3.11" \
"pytorch=*=cpu*" \
Expand All @@ -110,14 +108,14 @@ RUN mamba install --yes --use-local \
"r-gmmat" \
"r-saige" && \
sync && \
rm -rf /usr/local/mambaforge/conda-bld && \
rm -rf /opt/conda/conda-bld && \
mamba clean --yes --all --force-pkgs-dirs && \
sync && \
find /usr/local/mambaforge/ -follow -type f -name "*.a" -delete && \
find /opt/conda/ -follow -type f -name "*.a" -delete && \
sync


# Final
# =====
FROM base
COPY --from=install /usr/local/mambaforge /usr/local/mambaforge
COPY --from=install /opt/conda /opt/conda
2 changes: 2 additions & 0 deletions recipes/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ numpy:
- 1.24
zlib:
- 1.2
pin_run_as_build:
python: x.x
9 changes: 5 additions & 4 deletions recipes/gwas/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- {{ compiler('rust') }}
- {{ compiler("rust") }}
- "sysroot_linux-64>=2.17"
host:
- python
- "cython>=3b1"
- mkl
- mkl-include
- "numpy>=1.22"
- "python>=3.11"
- "python"
- pip
- "setuptools>=62"
- "setuptools_scm>=6.2"
- "setuptools-rust"
- wheel
- zlib
run:
- mkl
- python
# Python dependencies
- "python=3.11"
- "numpy>=1.22"
- scipy
- pandas
Expand All @@ -40,6 +40,7 @@ requirements:
- pyyaml
- more-itertools
- typing_extensions
- mkl
# Compression tools
- zstd
- htslib
Expand Down
21 changes: 0 additions & 21 deletions recipes/python-blosc2/0001-expose-cmake-use-system-blosc2.patch

This file was deleted.

7 changes: 0 additions & 7 deletions recipes/python-blosc2/build.sh

This file was deleted.

56 changes: 0 additions & 56 deletions recipes/python-blosc2/meta.yaml

This file was deleted.

0 comments on commit 59e5426

Please sign in to comment.