From 820a188939e418079cb24cf1ac16393d8d70419d Mon Sep 17 00:00:00 2001 From: Alex Lubbock Date: Wed, 2 Oct 2024 19:54:14 +0100 Subject: [PATCH] feat: BLAST Dockerfile and GitHub CI pipeline --- .github/workflows/build-and-push.yml | 57 ++++++++++++++++++++++++++++ Dockerfile | 13 +++++++ README.md | 5 +++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/build-and-push.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml new file mode 100644 index 0000000..4fecae6 --- /dev/null +++ b/.github/workflows/build-and-push.yml @@ -0,0 +1,57 @@ +name: Build BLAST container push to quay.io + +on: + push: + branches: + - main + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Source + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Quay.io + uses: docker/login-action@v3 + with: + registry: quay.io + username: rosalindfranklininstitute+github_blast + password: ${{ secrets.QUAYIO_TOKEN }} + + - name: Set BLAST version + run: | + echo BLAST_VERSION=$([ "$GITHUB_REF_TYPE" = "tag" ] && echo $GITHUB_REF_NAME || curl https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/VERSION 2>/dev/null) >> $GITHUB_ENV + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + quay.io/rosalindfranklininstitute/blast + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + labels: | + blast-version=${{ env.BLAST_VERSION }} + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64,linux/arm64 + build-args: | + BLAST_VERSION=${{ env.BLAST_VERSION }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e6420c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.12-slim-bookworm AS blast + +ARG BLAST_VERSION + +RUN apt update && apt install -y wget g++ make liblmdb-dev libsqlite3-dev +RUN mkdir /blast +RUN wget -qO- https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${BLAST_VERSION}/ncbi-blast-${BLAST_VERSION}+-src.tar.gz \ + | tar xz --strip-components 2 -C /blast +WORKDIR /blast +RUN ./configure --with-projects=scripts/projects/blast/project.lst +RUN cd ReleaseMT/build && make all_p + +ENV PATH="$PATH:/blast/ReleaseMT/bin" \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5524d5 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# NCBI Blast+ tools + +Containerised build of [BLAST+](https://blast.ncbi.nlm.nih.gov/doc/blast-help/downloadblastdata.html). + +Work in progress! \ No newline at end of file