diff --git a/Dockerfile b/Dockerfile index 445b676..73b291f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,47 @@ LABEL author="Remi-Andre Olsen" \ maintainer="remi-andre.olsen@scilifelab.se" USER root + +# Check for arm64 architecture to install minimap2 +ARG TARGETARCH +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Install compliation tools for minimap2 + apt-get update;\ + apt-get install -y curl build-essential libz-dev;\ + fi + +ENV MINIMAP_VERSION=2.26 + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Download minimap2 + curl -L https://github.com/lh3/minimap2/archive/refs/tags/v${MINIMAP_VERSION}.tar.gz | tar -zxvf - ;\ + fi + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Compile minimap2 + cd minimap2-${MINIMAP_VERSION};\ + make arm_neon=1 aarch64=1; \ + # Add to path + mv minimap2 /usr/local/bin/;\ + fi + COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml / -RUN micromamba env create -n anglerfish && micromamba install -y -n anglerfish -f /environment.yml && micromamba clean --all --yes -ENV PATH /opt/conda/envs/anglerfish/bin:$PATH +COPY --chown=$MAMBA_USER:$MAMBA_USER requirements.txt / + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + grep -v 'minimap2' /environment.yml > /environment.tmp.yml ;\ + else \ + cp /environment.yml /environment.tmp.yml ;\ + fi ;\ + chown $MAMBA_USER:$MAMBA_USER /environment.tmp.yml # Add source files to the container ADD . /usr/src/anglerfish WORKDIR /usr/src/anglerfish -RUN eval "$(micromamba shell hook --shell bash)" && micromamba activate anglerfish && python -m pip install .[dev] + +# Activate the environment +ARG MAMBA_DOCKERFILE_ACTIVATE=1 +RUN micromamba install -y -f /environment.tmp.yml && micromamba clean --all --yes + +RUN eval "$(micromamba shell hook --shell bash)" && python -m pip install .[dev] USER $MAMBA_USER diff --git a/environment.yml b/environment.yml index 26fd280..ec2d96d 100644 --- a/environment.yml +++ b/environment.yml @@ -4,10 +4,9 @@ channels: - conda-forge - bioconda dependencies: - - conda-forge::biopython=1.79 - - conda-forge::python-levenshtein=0.23.0 - - conda-forge::numpy>=1.22.0 - - bioconda::minimap2=2.20 - - conda-forge::pyyaml=6.0 + - bioconda::minimap2=2.26 + - pip + - pip: + - -r requirements.txt - conda-forge::pre-commit - conda-forge::prettier diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9fd76d3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +numpy==1.26.3 +biopython==1.83 +levenshtein==0.23.0 +pyyaml==6.0.1 \ No newline at end of file diff --git a/setup.py b/setup.py index bba0426..0b50d3f 100644 --- a/setup.py +++ b/setup.py @@ -32,12 +32,8 @@ python_requires=">=3.10", packages=find_packages(), package_data={"": ["config/adaptors.yaml"]}, - install_requires=[ - "python-levenshtein==0.23.0", - "biopython==1.79", - "numpy>=1.22.0", - "pyyaml==6.0", - ], + # Read requirements.txt + install_requires=[x.strip() for x in open("requirements.txt").readlines()], extras_require={"dev": ["ruff", "mypy", "editorconfig-checker"]}, entry_points={ "console_scripts": [